victory-brush-container 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 +6 -0
- package/dist/victory-brush-container.js +134 -88
- package/dist/victory-brush-container.min.js +1 -1
- package/es/brush-helpers.d.ts +0 -1
- package/es/brush-helpers.js +14 -14
- 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 -14
- package/lib/victory-brush-container.d.ts +41 -41
- package/lib/victory-brush-container.js +5 -5
- package/package.json +2 -30
- package/src/brush-helpers.ts +3 -1
- package/src/victory-brush-container.tsx +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -543,14 +543,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
543
543
|
/* harmony export */ "VictoryBrushContainer": function() { return /* binding */ VictoryBrushContainer; },
|
|
544
544
|
/* harmony export */ "useVictoryBrushContainer": function() { return /* binding */ useVictoryBrushContainer; }
|
|
545
545
|
/* harmony export */ });
|
|
546
|
-
/* harmony import */ var
|
|
547
|
-
/* harmony import */ var
|
|
548
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
|
|
549
|
-
/* 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__);
|
|
550
548
|
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-primitives/rect.js");
|
|
551
549
|
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/selection.js");
|
|
552
550
|
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-container/victory-container.js");
|
|
553
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__);
|
|
554
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");
|
|
555
555
|
/* harmony import */ var react_fast_compare__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_fast_compare__WEBPACK_IMPORTED_MODULE_2__);
|
|
556
556
|
|
|
@@ -562,13 +562,13 @@ const VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS = {
|
|
|
562
562
|
allowDrag: true,
|
|
563
563
|
allowDraw: true,
|
|
564
564
|
allowResize: true,
|
|
565
|
-
brushComponent: /*#__PURE__*/
|
|
565
|
+
brushComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_3__.Rect, null),
|
|
566
566
|
brushStyle: {
|
|
567
567
|
stroke: "transparent",
|
|
568
568
|
fill: "black",
|
|
569
569
|
fillOpacity: 0.1
|
|
570
570
|
},
|
|
571
|
-
handleComponent: /*#__PURE__*/
|
|
571
|
+
handleComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_3__.Rect, null),
|
|
572
572
|
handleStyle: {
|
|
573
573
|
stroke: "transparent",
|
|
574
574
|
fill: "transparent"
|
|
@@ -596,14 +596,14 @@ const useVictoryBrushContainer = initialProps => {
|
|
|
596
596
|
} = props;
|
|
597
597
|
const brushComponentStyle = brushComponent.props && brushComponent.props.style;
|
|
598
598
|
const cursor = !props.allowDrag && !props.allowResize ? "auto" : "move";
|
|
599
|
-
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, {
|
|
600
600
|
key: `${name}-brush`,
|
|
601
601
|
width: Math.abs(x[1] - x[0]) || 1,
|
|
602
602
|
height: Math.abs(y[1] - y[0]) || 1,
|
|
603
603
|
x: Math.min(x[0], x[1]),
|
|
604
604
|
y: Math.min(y[0], y[1]),
|
|
605
605
|
cursor,
|
|
606
|
-
style:
|
|
606
|
+
style: lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, brushComponentStyle, brushStyle)
|
|
607
607
|
}) : null;
|
|
608
608
|
};
|
|
609
609
|
const getCursorPointers = () => {
|
|
@@ -643,7 +643,7 @@ const useVictoryBrushContainer = initialProps => {
|
|
|
643
643
|
const width = Math.abs(x2 - x1) || 1;
|
|
644
644
|
const height = Math.abs(y2 - y1) || 1;
|
|
645
645
|
const handleComponentStyle = handleComponent.props && handleComponent.props.style || {};
|
|
646
|
-
const style =
|
|
646
|
+
const style = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, handleComponentStyle, handleStyle);
|
|
647
647
|
const cursors = getCursorPointers();
|
|
648
648
|
const yProps = {
|
|
649
649
|
style,
|
|
@@ -675,7 +675,7 @@ const useVictoryBrushContainer = initialProps => {
|
|
|
675
675
|
x: right.x1
|
|
676
676
|
}, xProps)
|
|
677
677
|
};
|
|
678
|
-
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({
|
|
679
679
|
key: `${name}-handle-${curr}`
|
|
680
680
|
}, handleProps[curr]))) : memo, []);
|
|
681
681
|
return handles.length ? handles : null;
|
|
@@ -685,15 +685,15 @@ const useVictoryBrushContainer = initialProps => {
|
|
|
685
685
|
currentDomain,
|
|
686
686
|
cachedBrushDomain
|
|
687
687
|
} = props;
|
|
688
|
-
const brushDomain =
|
|
689
|
-
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;
|
|
690
690
|
const coordinates = victory_core__WEBPACK_IMPORTED_MODULE_5__.getDomainCoordinates(props, domain);
|
|
691
691
|
const selectBox = getSelectBox(coordinates);
|
|
692
692
|
return selectBox ? [selectBox, getHandles(domain)] : [];
|
|
693
693
|
};
|
|
694
694
|
return {
|
|
695
695
|
props,
|
|
696
|
-
children: [...
|
|
696
|
+
children: [...react__WEBPACK_IMPORTED_MODULE_0___default().Children.toArray(children), ...getRect()]
|
|
697
697
|
};
|
|
698
698
|
};
|
|
699
699
|
const VictoryBrushContainer = initialProps => {
|
|
@@ -701,7 +701,7 @@ const VictoryBrushContainer = initialProps => {
|
|
|
701
701
|
props,
|
|
702
702
|
children
|
|
703
703
|
} = useVictoryBrushContainer(initialProps);
|
|
704
|
-
return /*#__PURE__*/
|
|
704
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_6__.VictoryContainer, props, children);
|
|
705
705
|
};
|
|
706
706
|
VictoryBrushContainer.role = "container";
|
|
707
707
|
VictoryBrushContainer.defaultEvents = initialProps => {
|
|
@@ -2851,16 +2851,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2851
2851
|
/* harmony export */ "VictoryContainer": function() { return /* binding */ VictoryContainer; },
|
|
2852
2852
|
/* harmony export */ "useVictoryContainer": function() { return /* binding */ useVictoryContainer; }
|
|
2853
2853
|
/* harmony export */ });
|
|
2854
|
-
/* harmony import */ var
|
|
2855
|
-
/* harmony import */ var
|
|
2856
|
-
/* harmony import */ var
|
|
2857
|
-
/* 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__);
|
|
2858
2858
|
/* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
|
|
2859
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");
|
|
2860
2860
|
/* harmony import */ var _victory_util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-util */ "../../victory-core/es/victory-util/merge-refs.js");
|
|
2861
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");
|
|
2862
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");
|
|
2863
|
-
|
|
2864
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); }
|
|
2865
2864
|
|
|
2866
2865
|
|
|
@@ -2868,9 +2867,10 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
2868
2867
|
|
|
2869
2868
|
|
|
2870
2869
|
|
|
2870
|
+
|
|
2871
2871
|
const defaultProps = {
|
|
2872
2872
|
className: "VictoryContainer",
|
|
2873
|
-
portalComponent: /*#__PURE__*/
|
|
2873
|
+
portalComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_2__.Portal, null),
|
|
2874
2874
|
portalZIndex: 99,
|
|
2875
2875
|
responsive: true,
|
|
2876
2876
|
role: "img"
|
|
@@ -2887,10 +2887,10 @@ function useVictoryContainer(initialProps) {
|
|
|
2887
2887
|
height,
|
|
2888
2888
|
responsive
|
|
2889
2889
|
} = props;
|
|
2890
|
-
const localContainerRef = (0,
|
|
2890
|
+
const localContainerRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
2891
2891
|
|
|
2892
2892
|
// Generated ID stored in ref because it needs to persist across renders
|
|
2893
|
-
const generatedId = (0,
|
|
2893
|
+
const generatedId = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_1___default()("victory-container-"));
|
|
2894
2894
|
const containerId = props.containerId ?? generatedId.current;
|
|
2895
2895
|
const getIdForElement = elName => `${containerId}-${elName}`;
|
|
2896
2896
|
const userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_3__.getSafeUserProps(props);
|
|
@@ -2949,7 +2949,7 @@ const VictoryContainer = initialProps => {
|
|
|
2949
2949
|
containerRef,
|
|
2950
2950
|
localContainerRef
|
|
2951
2951
|
} = useVictoryContainer(initialProps);
|
|
2952
|
-
|
|
2952
|
+
react__WEBPACK_IMPORTED_MODULE_0___default().useEffect(() => {
|
|
2953
2953
|
if (!events?.onWheel) return;
|
|
2954
2954
|
const handleWheel = e => e.preventDefault();
|
|
2955
2955
|
const container = localContainerRef?.current;
|
|
@@ -2959,7 +2959,7 @@ const VictoryContainer = initialProps => {
|
|
|
2959
2959
|
};
|
|
2960
2960
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2961
2961
|
}, []);
|
|
2962
|
-
return /*#__PURE__*/
|
|
2962
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
2963
2963
|
className: className,
|
|
2964
2964
|
style: {
|
|
2965
2965
|
...style,
|
|
@@ -2973,7 +2973,7 @@ const VictoryContainer = initialProps => {
|
|
|
2973
2973
|
"data-ouia-component-type": ouiaType,
|
|
2974
2974
|
"data-ouia-safe": ouiaSafe,
|
|
2975
2975
|
ref: (0,_victory_util__WEBPACK_IMPORTED_MODULE_4__.mergeRefs)([localContainerRef, containerRef])
|
|
2976
|
-
}, /*#__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({
|
|
2977
2977
|
width: width,
|
|
2978
2978
|
height: height,
|
|
2979
2979
|
tabIndex: tabIndex,
|
|
@@ -2986,11 +2986,11 @@ const VictoryContainer = initialProps => {
|
|
|
2986
2986
|
...dimensions,
|
|
2987
2987
|
pointerEvents: "all"
|
|
2988
2988
|
}
|
|
2989
|
-
}, userProps, events), title ? /*#__PURE__*/
|
|
2989
|
+
}, userProps, events), title ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("title", {
|
|
2990
2990
|
id: titleId
|
|
2991
|
-
}, title) : null, desc ? /*#__PURE__*/
|
|
2991
|
+
}, title) : null, desc ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("desc", {
|
|
2992
2992
|
id: descId
|
|
2993
|
-
}, desc) : null, children), /*#__PURE__*/
|
|
2993
|
+
}, desc) : null, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
2994
2994
|
style: {
|
|
2995
2995
|
...dimensions,
|
|
2996
2996
|
zIndex: portalZIndex,
|
|
@@ -2998,7 +2998,7 @@ const VictoryContainer = initialProps => {
|
|
|
2998
2998
|
top: 0,
|
|
2999
2999
|
left: 0
|
|
3000
3000
|
}
|
|
3001
|
-
}, /*#__PURE__*/
|
|
3001
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_victory_portal_portal_outlet__WEBPACK_IMPORTED_MODULE_6__.PortalOutlet, {
|
|
3002
3002
|
as: portalComponent,
|
|
3003
3003
|
width: width,
|
|
3004
3004
|
height: height,
|
|
@@ -3270,40 +3270,45 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3270
3270
|
/* harmony export */ "reduceChildren": function() { return /* binding */ reduceChildren; },
|
|
3271
3271
|
/* harmony export */ "scalePoint": function() { return /* binding */ scalePoint; }
|
|
3272
3272
|
/* harmony export */ });
|
|
3273
|
-
/* harmony import */ var
|
|
3274
|
-
/* harmony import */ var
|
|
3275
|
-
/* harmony import */ var
|
|
3276
|
-
/* harmony import */ var
|
|
3277
|
-
/* harmony import */ var
|
|
3278
|
-
/* harmony import */ var
|
|
3279
|
-
/* harmony import */ var
|
|
3280
|
-
/* harmony import */ var
|
|
3281
|
-
|
|
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__);
|
|
3282
3281
|
|
|
3283
3282
|
|
|
3284
3283
|
|
|
3285
|
-
// Private Functions
|
|
3286
3284
|
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3285
|
+
/**
|
|
3286
|
+
* Determine the range of a cartesian axis
|
|
3287
|
+
*/
|
|
3288
|
+
function getCartesianRange(options) {
|
|
3289
|
+
const vertical = options.axis !== "x";
|
|
3291
3290
|
if (vertical) {
|
|
3292
|
-
return [
|
|
3291
|
+
return [options.height - options.padding.bottom, options.padding.top];
|
|
3293
3292
|
}
|
|
3294
|
-
return [padding.left,
|
|
3293
|
+
return [options.padding.left, options.width - options.padding.right];
|
|
3295
3294
|
}
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
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);
|
|
3300
3303
|
return [startAngle, endAngle];
|
|
3301
3304
|
}
|
|
3302
|
-
return [
|
|
3305
|
+
return [options.innerRadius || 0, getRadius({
|
|
3306
|
+
height: options.height,
|
|
3307
|
+
width: options.width,
|
|
3308
|
+
padding: options.padding
|
|
3309
|
+
})];
|
|
3303
3310
|
}
|
|
3304
3311
|
|
|
3305
|
-
// Exported Functions
|
|
3306
|
-
|
|
3307
3312
|
/**
|
|
3308
3313
|
* Creates an object composed of the inverted keys and values of object.
|
|
3309
3314
|
* If object contains duplicate values, subsequent values overwrite property assignments of previous values.
|
|
@@ -3340,8 +3345,11 @@ function omit(originalObject, ks) {
|
|
|
3340
3345
|
}
|
|
3341
3346
|
return newObject;
|
|
3342
3347
|
}
|
|
3348
|
+
|
|
3349
|
+
/**
|
|
3350
|
+
* Coalesce the x and y values from a data point
|
|
3351
|
+
*/
|
|
3343
3352
|
function getPoint(datum) {
|
|
3344
|
-
const exists = val => val !== undefined;
|
|
3345
3353
|
const {
|
|
3346
3354
|
_x,
|
|
3347
3355
|
_x1,
|
|
@@ -3352,16 +3360,20 @@ function getPoint(datum) {
|
|
|
3352
3360
|
_y0,
|
|
3353
3361
|
_voronoiY
|
|
3354
3362
|
} = datum;
|
|
3355
|
-
const defaultX =
|
|
3356
|
-
const defaultY =
|
|
3363
|
+
const defaultX = _x1 ?? _x;
|
|
3364
|
+
const defaultY = _y1 ?? _y;
|
|
3357
3365
|
const point = {
|
|
3358
|
-
x:
|
|
3359
|
-
x0:
|
|
3360
|
-
y:
|
|
3361
|
-
y0:
|
|
3366
|
+
x: _voronoiX ?? defaultX,
|
|
3367
|
+
x0: _x0 ?? _x,
|
|
3368
|
+
y: _voronoiY ?? defaultY,
|
|
3369
|
+
y0: _y0 ?? _y
|
|
3362
3370
|
};
|
|
3363
|
-
return
|
|
3371
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, point, datum);
|
|
3364
3372
|
}
|
|
3373
|
+
|
|
3374
|
+
/**
|
|
3375
|
+
* Scale a point based on the origin, direction, and given scale function
|
|
3376
|
+
*/
|
|
3365
3377
|
function scalePoint(props, datum) {
|
|
3366
3378
|
const {
|
|
3367
3379
|
scale,
|
|
@@ -3384,11 +3396,11 @@ function scalePoint(props, datum) {
|
|
|
3384
3396
|
y0: polar ? -y0 * Math.sin(x0) + origin.x : y0
|
|
3385
3397
|
};
|
|
3386
3398
|
}
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3399
|
+
|
|
3400
|
+
/**
|
|
3401
|
+
* Returns a padding value from a number or partial padding values
|
|
3402
|
+
*/
|
|
3403
|
+
function getPadding(padding) {
|
|
3392
3404
|
const paddingVal = typeof padding === "number" ? padding : 0;
|
|
3393
3405
|
const paddingObj = typeof padding === "object" ? padding : {};
|
|
3394
3406
|
return {
|
|
@@ -3398,6 +3410,10 @@ function getPadding(props, name) {
|
|
|
3398
3410
|
right: paddingObj.right || paddingVal
|
|
3399
3411
|
};
|
|
3400
3412
|
}
|
|
3413
|
+
|
|
3414
|
+
/**
|
|
3415
|
+
* Returns true if the component is defined as a tooltip
|
|
3416
|
+
*/
|
|
3401
3417
|
function isTooltip(component) {
|
|
3402
3418
|
const labelRole = component && component.type && component.type.role;
|
|
3403
3419
|
return labelRole === "tooltip";
|
|
@@ -3412,8 +3428,8 @@ function getDefaultStyles(props, role) {
|
|
|
3412
3428
|
return defaultStyles;
|
|
3413
3429
|
}
|
|
3414
3430
|
const tooltipStyle = theme.tooltip && theme.tooltip.style || {};
|
|
3415
|
-
const labelStyle =
|
|
3416
|
-
return
|
|
3431
|
+
const labelStyle = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, tooltipStyle, defaultStyles.labels);
|
|
3432
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, {
|
|
3417
3433
|
labels: labelStyle
|
|
3418
3434
|
}, defaultStyles);
|
|
3419
3435
|
}
|
|
@@ -3421,7 +3437,7 @@ function getStyles(style, defaultStyles) {
|
|
|
3421
3437
|
const width = "100%";
|
|
3422
3438
|
const height = "100%";
|
|
3423
3439
|
if (!style) {
|
|
3424
|
-
return
|
|
3440
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({
|
|
3425
3441
|
parent: {
|
|
3426
3442
|
height,
|
|
3427
3443
|
width
|
|
@@ -3437,14 +3453,18 @@ function getStyles(style, defaultStyles) {
|
|
|
3437
3453
|
const defaultLabels = defaultStyles && defaultStyles.labels || {};
|
|
3438
3454
|
const defaultData = defaultStyles && defaultStyles.data || {};
|
|
3439
3455
|
return {
|
|
3440
|
-
parent:
|
|
3456
|
+
parent: lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, parent, defaultParent, {
|
|
3441
3457
|
width,
|
|
3442
3458
|
height
|
|
3443
3459
|
}),
|
|
3444
|
-
labels:
|
|
3445
|
-
data:
|
|
3460
|
+
labels: lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, labels, defaultLabels),
|
|
3461
|
+
data: lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, data, defaultData)
|
|
3446
3462
|
};
|
|
3447
3463
|
}
|
|
3464
|
+
|
|
3465
|
+
/**
|
|
3466
|
+
* Returns the value of a prop or accessor function with the given props
|
|
3467
|
+
*/
|
|
3448
3468
|
function evaluateProp(prop, props) {
|
|
3449
3469
|
return isFunction(prop) ? prop(props) : prop;
|
|
3450
3470
|
}
|
|
@@ -3466,19 +3486,28 @@ function degreesToRadians(degrees) {
|
|
|
3466
3486
|
function radiansToDegrees(radians) {
|
|
3467
3487
|
return typeof radians === "number" ? radians / (Math.PI / 180) : radians;
|
|
3468
3488
|
}
|
|
3469
|
-
|
|
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;
|
|
3470
3499
|
const {
|
|
3471
3500
|
left,
|
|
3472
3501
|
right,
|
|
3473
3502
|
top,
|
|
3474
3503
|
bottom
|
|
3475
|
-
} =
|
|
3476
|
-
const {
|
|
3477
|
-
width,
|
|
3478
|
-
height
|
|
3479
|
-
} = props;
|
|
3504
|
+
} = padding;
|
|
3480
3505
|
return Math.min(width - left - right, height - top - bottom) / 2;
|
|
3481
3506
|
}
|
|
3507
|
+
|
|
3508
|
+
/**
|
|
3509
|
+
* Returns the origin for a polar chart within the padded area
|
|
3510
|
+
*/
|
|
3482
3511
|
function getPolarOrigin(props) {
|
|
3483
3512
|
const {
|
|
3484
3513
|
width,
|
|
@@ -3489,7 +3518,7 @@ function getPolarOrigin(props) {
|
|
|
3489
3518
|
bottom,
|
|
3490
3519
|
left,
|
|
3491
3520
|
right
|
|
3492
|
-
} = getPadding(props);
|
|
3521
|
+
} = getPadding(props.padding);
|
|
3493
3522
|
const radius = Math.min(width - left - right, height - top - bottom) / 2;
|
|
3494
3523
|
const offsetWidth = width / 2 + left - right;
|
|
3495
3524
|
const offsetHeight = height / 2 + top - bottom;
|
|
@@ -3498,13 +3527,30 @@ function getPolarOrigin(props) {
|
|
|
3498
3527
|
y: offsetHeight + radius > height ? radius + top - bottom : offsetHeight
|
|
3499
3528
|
};
|
|
3500
3529
|
}
|
|
3530
|
+
|
|
3531
|
+
/**
|
|
3532
|
+
* Determine the range of an axis based on the given props
|
|
3533
|
+
*/
|
|
3501
3534
|
function getRange(props, axis) {
|
|
3502
3535
|
if (props.range && props.range[axis]) {
|
|
3503
3536
|
return props.range[axis];
|
|
3504
3537
|
} else if (props.range && Array.isArray(props.range)) {
|
|
3505
3538
|
return props.range;
|
|
3506
3539
|
}
|
|
3507
|
-
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
|
+
});
|
|
3508
3554
|
}
|
|
3509
3555
|
|
|
3510
3556
|
/**
|
|
@@ -3536,7 +3582,7 @@ function createAccessor(key) {
|
|
|
3536
3582
|
return x => x;
|
|
3537
3583
|
}
|
|
3538
3584
|
// otherwise, assume it is an array index, property key or path (_.property handles all three)
|
|
3539
|
-
return
|
|
3585
|
+
return lodash_property__WEBPACK_IMPORTED_MODULE_2___default()(key);
|
|
3540
3586
|
}
|
|
3541
3587
|
function modifyProps(props, fallbackProps, role) {
|
|
3542
3588
|
const theme = props.theme && props.theme[role] ? props.theme[role] : {};
|
|
@@ -3545,7 +3591,7 @@ function modifyProps(props, fallbackProps, role) {
|
|
|
3545
3591
|
const defaultObject = horizontal === undefined ? {} : {
|
|
3546
3592
|
horizontal
|
|
3547
3593
|
};
|
|
3548
|
-
return
|
|
3594
|
+
return lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()(defaultObject, props, themeProps, fallbackProps);
|
|
3549
3595
|
}
|
|
3550
3596
|
|
|
3551
3597
|
/**
|
|
@@ -3632,10 +3678,10 @@ initialMemo, combine) {
|
|
|
3632
3678
|
const childRole = child.type && child.type.role;
|
|
3633
3679
|
const childName = child.props.name || `${childRole}-${names[index]}`;
|
|
3634
3680
|
if (child.props && child.props.children) {
|
|
3635
|
-
const childProps = Object.assign({}, child.props,
|
|
3636
|
-
const nestedChildren = child.type && child.type.role === "stack" && isFunction(child.type.getChildren) ? child.type.getChildren(childProps) :
|
|
3637
|
-
const nestedChildProps = Object.assign({}, c.props,
|
|
3638
|
-
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);
|
|
3639
3685
|
});
|
|
3640
3686
|
const childNames = nestedChildren.map((c, i) => `${childName}-${i}`);
|
|
3641
3687
|
const nestedResults = traverseChildren(nestedChildren, childNames, child);
|
|
@@ -3649,7 +3695,7 @@ initialMemo, combine) {
|
|
|
3649
3695
|
return newMemo;
|
|
3650
3696
|
}, initialMemo);
|
|
3651
3697
|
};
|
|
3652
|
-
const validChildren = children.filter(
|
|
3698
|
+
const validChildren = children.filter(react__WEBPACK_IMPORTED_MODULE_0__.isValidElement);
|
|
3653
3699
|
const childNames = validChildren.map((c, i) => i);
|
|
3654
3700
|
return traverseChildren(validChildren, childNames);
|
|
3655
3701
|
}
|
|
@@ -3669,10 +3715,10 @@ function isHorizontal(props) {
|
|
|
3669
3715
|
if (memo || childProps.horizontal || !childProps.children) {
|
|
3670
3716
|
return memo || childProps.horizontal;
|
|
3671
3717
|
}
|
|
3672
|
-
return traverseChildren(
|
|
3718
|
+
return traverseChildren(react__WEBPACK_IMPORTED_MODULE_0___default().Children.toArray(childProps.children));
|
|
3673
3719
|
}, false);
|
|
3674
3720
|
};
|
|
3675
|
-
return traverseChildren(
|
|
3721
|
+
return traverseChildren(react__WEBPACK_IMPORTED_MODULE_0___default().Children.toArray(props.children));
|
|
3676
3722
|
}
|
|
3677
3723
|
|
|
3678
3724
|
/***/ }),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("react")):"function"==typeof define&&define.amd?define(["react"],n):"object"==typeof exports?exports.VictoryBrushContainer=n(require("react")):t.VictoryBrushContainer=n(t.React)}(self,(function(t){return function(){var n={2596:function(t,n,e){var r=e(2373).Symbol;t.exports=r},6082:function(t){t.exports=function(t,n,e){switch(e.length){case 0:return t.call(n);case 1:return t.call(n,e[0]);case 2:return t.call(n,e[0],e[1]);case 3:return t.call(n,e[0],e[1],e[2])}return t.apply(n,e)}},8644:function(t){t.exports=function(t,n){for(var e=-1,r=null==t?0:t.length,o=Array(r);++e<r;)o[e]=n(t[e],e,t);return o}},9559:function(t){t.exports=function(t,n){for(var e=-1,r=n.length,o=t.length;++e<r;)t[o+e]=n[e];return t}},4132:function(t,n,e){var r=e(8347),o=e(788),i=Object.prototype.hasOwnProperty;t.exports=function(t,n,e){var a=t[n];i.call(t,n)&&o(a,e)&&(void 0!==e||n in t)||r(t,n,e)}},8347:function(t,n,e){var r=e(5525);t.exports=function(t,n,e){"__proto__"==n&&r?r(t,n,{configurable:!0,enumerable:!0,value:e,writable:!0}):t[n]=e}},6457:function(t,n,e){var r=e(9559),o=e(3608);t.exports=function t(n,e,i,a,u){var s=-1,c=n.length;for(i||(i=o),u||(u=[]);++s<c;){var l=n[s];e>0&&i(l)?e>1?t(l,e-1,i,a,u):r(u,l):a||(u[u.length]=l)}return u}},4432:function(t,n,e){var r=e(9026),o=e(3110);t.exports=function(t,n){for(var e=0,i=(n=r(n,t)).length;null!=t&&e<i;)t=t[o(n[e++])];return e&&e==i?t:void 0}},6776:function(t){t.exports=function(t,n){return null!=t&&n in Object(t)}},5436:function(t,n,e){var r=e(6371),o=e(5066);t.exports=function(t,n){return r(t,n,(function(n,e){return o(t,e)}))}},6371:function(t,n,e){var r=e(4432),o=e(6539),i=e(9026);t.exports=function(t,n,e){for(var a=-1,u=n.length,s={};++a<u;){var c=n[a],l=r(t,c);e(l,c)&&o(s,i(c,t),l)}return s}},1600:function(t){t.exports=function(t){return function(n){return null==n?void 0:n[t]}}},3301:function(t,n,e){var r=e(4432);t.exports=function(t){return function(n){return r(n,t)}}},6317:function(t,n,e){var r=e(5346),o=e(4280),i=e(201);t.exports=function(t,n){return i(o(t,n,r),t+"")}},6539:function(t,n,e){var r=e(4132),o=e(9026),i=e(9099),a=e(7709),u=e(3110);t.exports=function(t,n,e,s){if(!a(t))return t;for(var c=-1,l=(n=o(n,t)).length,f=l-1,h=t;null!=h&&++c<l;){var x=u(n[c]),y=e;if("__proto__"===x||"constructor"===x||"prototype"===x)return t;if(c!=f){var p=h[x];void 0===(y=s?s(p,x,h):void 0)&&(y=a(p)?p:i(n[c+1])?[]:{})}r(h,x,y),h=h[x]}return t}},6316:function(t,n,e){var r=e(2596),o=e(8644),i=e(163),a=e(1995),u=r?r.prototype:void 0,s=u?u.toString:void 0;t.exports=function t(n){if("string"==typeof n)return n;if(i(n))return o(n,t)+"";if(a(n))return s?s.call(n):"";var e=n+"";return"0"==e&&1/n==-1/0?"-0":e}},9026:function(t,n,e){var r=e(163),o=e(726),i=e(7801),a=e(7010);t.exports=function(t,n){return r(t)?t:o(t,n)?[t]:i(a(t))}},5525:function(t,n,e){var r=e(3743),o=function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},5557:function(t,n,e){var r=e(2645),o=e(4280),i=e(201);t.exports=function(t){return i(o(t,void 0,r),t+"")}},2117:function(t,n,e){var r="object"==typeof e.g&&e.g&&e.g.Object===Object&&e.g;t.exports=r},3743:function(t){t.exports=function(t,n){return null==t?void 0:t[n]}},3096:function(t,n,e){var r=e(9026),o=e(5075),i=e(163),a=e(9099),u=e(8454),s=e(3110);t.exports=function(t,n,e){for(var c=-1,l=(n=r(n,t)).length,f=!1;++c<l;){var h=s(n[c]);if(!(f=null!=t&&e(t,h)))break;t=t[h]}return f||++c!=l?f:!!(l=null==t?0:t.length)&&u(l)&&a(h,l)&&(i(t)||o(t))}},3608:function(t,n,e){var r=e(2596),o=e(5075),i=e(163),a=r?r.isConcatSpreadable:void 0;t.exports=function(t){return i(t)||o(t)||!!(a&&t&&t[a])}},9099:function(t){var n=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&n.test(t))&&t>-1&&t%1==0&&t<e}},8286:function(t){t.exports=function(){return!1}},726:function(t,n,e){var r=e(163),o=e(1995),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;t.exports=function(t,n){if(r(t))return!1;var e=typeof t;return!("number"!=e&&"symbol"!=e&&"boolean"!=e&&null!=t&&!o(t))||a.test(t)||!i.test(t)||null!=n&&t in Object(n)}},2453:function(t){t.exports=function(t){return t}},4280:function(t,n,e){var r=e(6082),o=Math.max;t.exports=function(t,n,e){return n=o(void 0===n?t.length-1:n,0),function(){for(var i=arguments,a=-1,u=o(i.length-n,0),s=Array(u);++a<u;)s[a]=i[n+a];a=-1;for(var c=Array(n+1);++a<n;)c[a]=i[a];return c[n]=e(s),r(t,this,c)}}},2373:function(t,n,e){var r=e(2117),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();t.exports=i},201:function(t){t.exports=function(t){return t}},7801:function(t,n,e){var r=e(2453),o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,a=r((function(t){var n=[];return 46===t.charCodeAt(0)&&n.push(""),t.replace(o,(function(t,e,r,o){n.push(r?o.replace(i,"$1"):e||t)})),n}));t.exports=a},3110:function(t,n,e){var r=e(1995);t.exports=function(t){if("string"==typeof t||r(t))return t;var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}},5034:function(t,n,e){var r=e(7709),o=e(6987),i=e(5812),a=Math.max,u=Math.min;t.exports=function(t,n,e){var s,c,l,f,h,x,y=0,p=!1,d=!1,m=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function v(n){var e=s,r=c;return s=c=void 0,y=n,f=t.apply(r,e)}function g(t){return y=t,h=setTimeout(M,n),p?v(t):f}function b(t){var e=t-x;return void 0===x||e>=n||e<0||d&&t-y>=l}function M(){var t=o();if(b(t))return w(t);h=setTimeout(M,function(t){var e=n-(t-x);return d?u(e,l-(t-y)):e}(t))}function w(t){return h=void 0,m&&s?v(t):(s=c=void 0,f)}function D(){var t=o(),e=b(t);if(s=arguments,c=this,x=t,e){if(void 0===h)return g(x);if(d)return clearTimeout(h),h=setTimeout(M,n),v(x)}return void 0===h&&(h=setTimeout(M,n)),f}return n=i(n)||0,r(e)&&(p=!!e.leading,l=(d="maxWait"in e)?a(i(e.maxWait)||0,n):l,m="trailing"in e?!!e.trailing:m),D.cancel=function(){void 0!==h&&clearTimeout(h),y=0,s=x=c=h=void 0},D.flush=function(){return void 0===h?f:w(o())},D}},1893:function(t,n,e){var r=e(6317),o=e(788),i=e(8286),a=e(8855),u=Object.prototype,s=u.hasOwnProperty,c=r((function(t,n){t=Object(t);var e=-1,r=n.length,c=r>2?n[2]:void 0;for(c&&i(n[0],n[1],c)&&(r=1);++e<r;)for(var l=n[e],f=a(l),h=-1,x=f.length;++h<x;){var y=f[h],p=t[y];(void 0===p||o(p,u[y])&&!s.call(t,y))&&(t[y]=l[y])}return t}));t.exports=c},788:function(t){t.exports=function(t,n){return t===n||t!=t&&n!=n}},2645:function(t,n,e){var r=e(6457);t.exports=function(t){return null!=t&&t.length?r(t,1):[]}},5066:function(t,n,e){var r=e(6776),o=e(3096);t.exports=function(t,n){return null!=t&&o(t,n,r)}},5346:function(t){t.exports=function(t){return t}},5075:function(t){t.exports=function(){return!1}},163:function(t){var n=Array.isArray;t.exports=n},8454:function(t){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},7709:function(t){t.exports=function(t){var n=typeof t;return null!=t&&("object"==n||"function"==n)}},1995:function(t){t.exports=function(){return!1}},8855:function(t){t.exports=function(t){var n=[];if(null!=t)for(var e in Object(t))n.push(e);return n}},6987:function(t,n,e){var r=e(2373);t.exports=function(){return r.Date.now()}},9082:function(t,n,e){var r=e(5436),o=e(5557)((function(t,n){return null==t?{}:r(t,n)}));t.exports=o},8532:function(t,n,e){var r=e(1600),o=e(3301),i=e(726),a=e(3110);t.exports=function(t){return i(t)?r(a(t)):o(t)}},8163:function(t,n,e){var r=e(5034),o=e(7709);t.exports=function(t,n,e){var i=!0,a=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return o(e)&&(i="leading"in e?!!e.leading:i,a="trailing"in e?!!e.trailing:a),r(t,n,{leading:i,maxWait:n,trailing:a})}},5812:function(t){t.exports=function(t){return t}},7010:function(t,n,e){var r=e(6316);t.exports=function(t){return null==t?"":r(t)}},660:function(t,n,e){var r=e(7010),o=0;t.exports=function(t){var n=++o;return r(t)+n}},7491:function(t){var n="undefined"!=typeof Element,e="function"==typeof Map,r="function"==typeof Set,o="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function i(t,a){if(t===a)return!0;if(t&&a&&"object"==typeof t&&"object"==typeof a){if(t.constructor!==a.constructor)return!1;var u,s,c,l;if(Array.isArray(t)){if((u=t.length)!=a.length)return!1;for(s=u;0!=s--;)if(!i(t[s],a[s]))return!1;return!0}if(e&&t instanceof Map&&a instanceof Map){if(t.size!==a.size)return!1;for(l=t.entries();!(s=l.next()).done;)if(!a.has(s.value[0]))return!1;for(l=t.entries();!(s=l.next()).done;)if(!i(s.value[1],a.get(s.value[0])))return!1;return!0}if(r&&t instanceof Set&&a instanceof Set){if(t.size!==a.size)return!1;for(l=t.entries();!(s=l.next()).done;)if(!a.has(s.value[0]))return!1;return!0}if(o&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(a)){if((u=t.length)!=a.length)return!1;for(s=u;0!=s--;)if(t[s]!==a[s])return!1;return!0}if(t.constructor===RegExp)return t.source===a.source&&t.flags===a.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===a.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===a.toString();if((u=(c=Object.keys(t)).length)!==Object.keys(a).length)return!1;for(s=u;0!=s--;)if(!Object.prototype.hasOwnProperty.call(a,c[s]))return!1;if(n&&t instanceof Element)return!1;for(s=u;0!=s--;)if(("_owner"!==c[s]&&"__v"!==c[s]&&"__o"!==c[s]||!t.$$typeof)&&!i(t[c[s]],a[c[s]]))return!1;return!0}return t!=t&&a!=a}t.exports=function(t,n){try{return i(t,n)}catch(t){if((t.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw t}}},9787:function(n){"use strict";n.exports=t}},e={};function r(t){var o=e[t];if(void 0!==o)return o.exports;var i=e[t]={exports:{}};return n[t](i,i.exports,r),i.exports}r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,{a:n}),n},r.d=function(t,n){for(var e in n)r.o(n,e)&&!r.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return function(){"use strict";r.r(o),r.d(o,{BrushHelpers:function(){return N},VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS:function(){return V},VictoryBrushContainer:function(){return k},useVictoryBrushContainer:function(){return $}});var t=r(1893),n=r.n(t),e=r(9787),i=r.n(e);function a(t,n){return u(t)?t(n):t}function u(t){return"function"==typeof t}function s(t,n){if(t)return Object.keys(t).reduce(((e,r)=>(e[r]=n(t[r]),e)),{})}function c(){return c=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},c.apply(this,arguments)}r(9082),r(8532);const l=(0,e.forwardRef)(((t,n)=>{const{desc:e,id:r,tabIndex:o,origin:u,...s}=t,l={vectorEffect:"non-scaling-stroke",id:a(r,t)?.toString(),tabIndex:a(o,t),...s};return e?i().createElement("rect",c({},l,{ref:n}),i().createElement("desc",null,e)):i().createElement("rect",c({},l,{ref:n}))}));function f(t){return Array.isArray(t)&&t.some((t=>t instanceof Date))}function h(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];const o=t.concat(e);return f(o)?new Date(Math.max(...o)):Math.max(...o)}function x(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];const o=t.concat(e);return f(o)?new Date(Math.min(...o)):Math.min(...o)}function y(t,n,e){const{a:r,d:o,e:i,f:a}=n;return"y"===e?o*t+a:r*t+i}function p(t){return!(!t||void 0===t.identifier)}function d(t){if(p(t.nativeEvent))return;const n=t=>"svg"===t.nodeName?t:t.parentNode?n(t.parentNode):t;return n(t.target)}function m(t,n){if(p(t.nativeEvent))return{x:t.nativeEvent.locationX,y:t.nativeEvent.locationY};const e=function(t){return t.changedTouches&&t.changedTouches.length>0}(t)?t.changedTouches[0]:t,r=function(t){return t.getScreenCTM().inverse()}(n||d(e));return{x:y(e.clientX,r,"x"),y:y(e.clientY,r,"y")}}function v(t,n){const{horizontal:e}=t,r=t.scale,o=n||{x:r.x.domain(),y:r.y.domain()};return{x:e?[r.y(o.y[0]),r.y(o.y[1])]:[r.x(o.x[0]),r.x(o.x[1])],y:e?[r.x(o.x[0]),r.x(o.x[1])]:[r.y(o.y[0]),r.y(o.y[1])]}}function g(t,n,e,r){const{polar:o,horizontal:i}=t;if(!o)return{x:i?n.x.invert(r):n.x.invert(e),y:i?n.y.invert(e):n.y.invert(r)};const a=t.origin||{x:0,y:0},u=e-a.x,s=r-a.y,c=Math.abs(u*Math.sqrt(1+Math.pow(-s/u,2))),l=(-Math.atan2(s,u)+2*Math.PI)%(2*Math.PI);return{x:n.x.invert(l),y:n.y.invert(c)}}function b(t){const{x1:n,x2:e,y1:r,y2:o,scale:i}=t,a=g(t,i,n,r),u=g(t,i,e,o),s=(t,n)=>[x([t,n]),h([t,n])];return{x:s(a.x,u.x),y:s(a.y,u.y)}}var M=r(660),w=r.n(M);function D(){return D=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},D.apply(this,arguments)}const B=i().forwardRef(((t,n)=>i().createElement("svg",D({ref:n},t)))),O={startsWith:["data-","aria-"],exactMatch:[]},E=t=>{const n={...t};return Object.fromEntries(Object.entries(n).filter((t=>{let[n]=t;return(t=>!(!(t=>{let n=!1;return O.startsWith.forEach((e=>{new RegExp(`\\b(${e})(\\w|-)+`,"g").test(t)&&(n=!0)})),n})(t)&&!(t=>O.exactMatch.includes(t))(t)))(n)})).map((n=>{let[e,r]=n;return[e,a(r,t)]})))},j=i().createContext(void 0);j.displayName="PortalContext";const S=t=>{let{children:n}=t;const[e,r]=i().useState(new Map),o=i().useCallback(((t,n)=>{r((e=>{const r=new Map(e);return r.set(t,n),r}))}),[r]),a=i().useCallback((t=>{r((n=>{const e=new Map(n);return e.delete(t),e}))}),[r]),u=i().useMemo((()=>({addChild:o,removeChild:a,children:e})),[o,a,e]);return i().createElement(j.Provider,{value:u},n)},A=t=>{let{as:n,...e}=t;const r=i().useContext(j);if(!r)return null;const o=Array.from(r.children.values());return i().cloneElement(n,e,o)};function P(){return P=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},P.apply(this,arguments)}const C={className:"VictoryContainer",portalComponent:i().createElement(B,null),portalZIndex:99,responsive:!0,role:"img"},R=t=>{const{role:n,title:r,desc:o,children:a,className:s,portalZIndex:c,portalComponent:l,width:f,height:h,style:x,tabIndex:y,responsive:p,events:d,ouiaId:m,ouiaSafe:v,ouiaType:g,dimensions:b,ariaDescribedBy:M,ariaLabelledBy:D,viewBox:B,preserveAspectRatio:O,userProps:j,titleId:R,descId:T,containerRef:G,localContainerRef:z}=function(t){const n={...C,...t},{title:r,desc:o,width:i,height:a,responsive:u}=n,s=(0,e.useRef)(null),c=(0,e.useRef)(w()("victory-container-")),l=n.containerId??c.current,f=t=>`${l}-${t}`,h=E(n),x=u?{width:"100%",height:"100%"}:{width:i,height:a},y=u?`0 0 ${i} ${a}`:void 0,p=u?n.preserveAspectRatio:void 0,d=[r&&f("title"),n["aria-labelledby"]].filter(Boolean).join(" ")||void 0,m=[o&&f("desc"),n["aria-describedby"]].filter(Boolean).join(" ")||void 0,v=f("title"),g=f("desc");return{...n,titleId:v,descId:g,dimensions:x,viewBox:y,preserveAspectRatio:p,ariaLabelledBy:d,ariaDescribedBy:m,userProps:h,localContainerRef:s}}(t);return i().useEffect((()=>{if(!d?.onWheel)return;const t=t=>t.preventDefault(),n=z?.current;return n?.addEventListener("wheel",t),()=>{n?.removeEventListener("wheel",t)}}),[]),i().createElement("div",{className:s,style:{...x,width:p?x?.width:b.width,height:p?x?.height:b.height,pointerEvents:x?.pointerEvents??"none",touchAction:x?.touchAction??"none",position:x?.position??"relative"},"data-ouia-component-id":m,"data-ouia-component-type":g,"data-ouia-safe":v,ref:(_=[z,G],t=>{_.forEach((n=>{u(n)?n(t):null!=n&&(n.current=t)}))})},i().createElement(S,null,i().createElement("svg",P({width:f,height:h,tabIndex:y,role:n,"aria-labelledby":D,"aria-describedby":M,viewBox:B,preserveAspectRatio:O,style:{...b,pointerEvents:"all"}},j,d),r?i().createElement("title",{id:R},r):null,o?i().createElement("desc",{id:T},o):null,a),i().createElement("div",{style:{...b,zIndex:c,position:"absolute",top:0,left:0}},i().createElement(A,{as:l,width:f,height:h,viewBox:B,preserveAspectRatio:O,style:{...b,overflow:"visible"}}))));var _};R.role="container";var T=r(8163),G=r.n(T),z=r(7491),_=r.n(z);const I={getDimension(t){const{horizontal:n,brushDimension:e}=t;return n&&e?"x"===e?"y":"x":e},withinBounds(t,n,e){const{x1:r,x2:o,y1:i,y2:a}=s(n,Number),{x:u,y:c}=s(t,Number),l=e?e/2:0;return u+l>=Math.min(r,o)&&u-l<=Math.max(r,o)&&c+l>=Math.min(i,a)&&c-l<=Math.max(i,a)},getDomainBox(t,e,r){const o=this.getDimension(t),i=n()({},e,t.domain),a=n()({},r,i),u=v(t,i),s=v(t,a);return{x1:"y"!==o?Math.min(...s.x):Math.min(...u.x),x2:"y"!==o?Math.max(...s.x):Math.max(...u.x),y1:"x"!==o?Math.min(...s.y):Math.min(...u.y),y2:"x"!==o?Math.max(...s.y):Math.max(...u.y)}},getHandles(t,n){const e=this.getDimension(t),{x1:r,x2:o,y1:i,y2:a}=n,u=Math.min(r,o),s=Math.max(r,o),c=Math.min(i,a),l=Math.max(i,a),f=t.handleWidth/2;return{left:"y"!==e&&{x1:u-f,x2:u+f,y1:i,y2:a},right:"y"!==e&&{x1:s-f,x2:s+f,y1:i,y2:a},top:"x"!==e&&{x1:r,x2:o,y1:c-f,y2:c+f},bottom:"x"!==e&&{x1:r,x2:o,y1:l-f,y2:l+f}}},getActiveHandles(t,n,e){const r=this.getHandles(n,e),o=["top","bottom","left","right"].reduce(((n,e)=>r[e]&&this.withinBounds(t,r[e])?n.concat(e):n),[]);return o.length&&o},getResizeMutation(t,n){const{x1:e,y1:r,x2:o,y2:i}=t,a={left:{x1:Math.max(e,o),x2:Math.min(e,o),y1:r,y2:i},right:{x1:Math.min(e,o),x2:Math.max(e,o),y1:r,y2:i},top:{y1:Math.max(r,i),y2:Math.min(r,i),x1:e,x2:o},bottom:{y1:Math.min(r,i),y2:Math.max(r,i),x1:e,x2:o}};return n.reduce(((t,n)=>Object.assign(t,a[n])),{})},getMinimumDomain:()=>({x:[0,1/Number.MAX_SAFE_INTEGER],y:[0,1/Number.MAX_SAFE_INTEGER]}),getDefaultBrushArea(t,n,e){const{domain:r,fullDomain:o,scale:i,horizontal:a,allowResize:u}=t,s=u||t.defaultBrushArea?t.defaultBrushArea:"move";if("none"===s)return this.getMinimumDomain();if("disable"===s)return n;if("move"===s){const r=this.getDomainBox(t,o,n),u=t.parentSVG||d(e),s=this.panBox({...t,...r,brushDomain:n,startX:(r.x1+r.x2)/2,startY:(r.y1+r.y2)/2},m(e,u)),c=t.fullDomainBox||this.getDomainBox(t,o);return b({...this.constrainBox(s,c),scale:i,horizontal:a})}return r},getSelectionMutation(t,n,e){const{x:r,y:o}=t,{x1:i,x2:a,y1:u,y2:s}=n;return{x1:"y"!==e?r:i,y1:"x"!==e?o:u,x2:"y"!==e?r:a,y2:"x"!==e?o:s}},panBox(t,e){const{domain:r,startX:o,startY:i}=t,a=this.getDimension(t),u=n()({},t.brushDomain,r),s=n()({},t.fullDomain,r),{x1:c,x2:l,y1:f,y2:h}=t.x1?t:this.getDomainBox(t,s,u),{x:x,y:y}=e,p=o?o-x:0,d=i?i-y:0;return{x1:"y"!==a?Math.min(c,l)-p:Math.min(c,l),x2:"y"!==a?Math.max(c,l)-p:Math.max(c,l),y1:"x"!==a?Math.min(f,h)-d:Math.min(f,h),y2:"x"!==a?Math.max(f,h)-d:Math.max(f,h)}},constrainBox(t,n){const{x1:e,y1:r,x2:o,y2:i}=s(n,Number);return{x1:t.x2>o?o-Math.abs(t.x2-t.x1):Math.max(t.x1,e),y1:t.y2>i?i-Math.abs(t.y2-t.y1):Math.max(t.y1,r),x2:t.x1<e?e+Math.abs(t.x2-t.x1):Math.min(t.x2,o),y2:t.y1<r?r+Math.abs(t.y2-t.y1):Math.min(t.y2,i)}},constrainPoint(t,n){const{x1:e,y1:r,x2:o,y2:i}=s(n,Number);return{x:Math.min(Math.max(t.x,e),o),y:Math.min(Math.max(t.y,r),i)}},hasMoved(t){const{x1:n,x2:e,y1:r,y2:o,mouseMoveThreshold:i}=t,a=this.getDimension(t),u=Math.abs(n-e)>=i,s=Math.abs(r-o)>=i;switch(a){case"x":return u;case"y":return s;default:return u||s}},onMouseDown(t,e){t.preventDefault();const{handleWidth:r,cachedBrushDomain:o,domain:i,allowResize:a,allowDrag:u,allowDraw:s}=e,c=this.getDimension(e),l=a||e.defaultBrushArea?e.defaultBrushArea:"move";if(!a&&!u)return{};const f=e.fullDomainBox||this.getDomainBox(e,i),h=e.parentSVG||d(t),{x:x,y:y}=m(t,h);if(!this.withinBounds({x:x,y:y},f,r))return{};const p=n()({},e.brushDomain,i),v=_()(p,o)?e.currentDomain||p||i:p||i,g=this.getDomainBox(e,i,v),b=a&&this.getActiveHandles({x:x,y:y},e,g);return b?[{target:"parent",mutation:()=>({isSelecting:!0,domainBox:g,fullDomainBox:f,cachedBrushDomain:p,currentDomain:v,parentSVG:h,...this.getResizeMutation(g,b)})}]:this.withinBounds({x:x,y:y},g)&&!_()(i,v)?[{target:"parent",mutation:()=>({isPanning:u,startX:x,startY:y,domainBox:g,fullDomainBox:f,currentDomain:v,cachedBrushDomain:p,parentSVG:h,...g})}]:s?[{target:"parent",mutation:()=>({isSelecting:a||"move"===l,domainBox:g,fullDomainBox:f,parentSVG:h,cachedBrushDomain:p,cachedCurrentDomain:v,currentDomain:this.getMinimumDomain(),...this.getSelectionMutation({x:x,y:y},g,c)})}]:{}},onGlobalMouseMove(t,e){const{scale:r,isPanning:o,isSelecting:i,fullDomainBox:a,onBrushDomainChange:s,allowResize:c,allowDrag:l,horizontal:f,mouseMoveThreshold:h,parentSVG:x}=e,y=this.getDimension(e),{x:p,y:d}=m(t,x);if(!c&&!l||h>0&&!this.hasMoved({...e,x2:p,y2:d}))return{};if(l&&o){const{startX:t,startY:o}=e,i=this.panBox(e,{x:p,y:d}),c=this.constrainBox(i,a),l=b({...c,scale:r,horizontal:f}),h={currentDomain:l,parentSVG:x,startX:i.x2>=a.x2||i.x1<=a.x1?t:p,startY:i.y2>=a.y2||i.y1<=a.y1?o:d,...c};return u(s)&&s(l,n()({},h,e)),[{target:"parent",mutation:()=>h}]}if(c&&i){const{x:t,y:o}=this.constrainPoint({x:"y"!==y?p:e.x2,y:"x"!==y?d:e.y2},a),i=b({x2:t,y2:o,x1:e.x1,y1:e.y1,scale:r,horizontal:f}),c={x2:t,y2:o,currentDomain:i,parentSVG:x};return u(s)&&s(i,n()({},c,e)),[{target:"parent",mutation:()=>c}]}return{}},onGlobalMouseUp(t,e){if(!e.isPanning&&!e.isSelecting)return{};const{x1:r,y1:o,x2:i,y2:a,isPanning:s,isSelecting:c,onBrushDomainChange:l,onBrushDomainChangeEnd:f,onBrushCleared:h,currentDomain:x,allowResize:y,allowDrag:p}=e,d=y||e.defaultBrushArea?e.defaultBrushArea:"move",m={isPanning:!1,isSelecting:!1};if(!y&&(void 0===d||"none"===d)||r!==i&&o!==a)(p&&s||y&&c)&&u(f)&&f(x,n()({},m,e));else{const r=e.cachedCurrentDomain||x,o=this.getDefaultBrushArea(e,r,t);m.currentDomain=o,u(l)&&l(o,n()({},m,e)),u(f)&&f(o,n()({},m,e)),u(h)&&h(o,n()({},m,e))}return[{target:"parent",mutation:()=>m}]}},N={...I,onMouseDown:I.onMouseDown.bind(I),onGlobalMouseUp:I.onGlobalMouseUp.bind(I),onGlobalMouseMove:G()(I.onGlobalMouseMove.bind(I),16,{leading:!0,trailing:!1})},V={allowDrag:!0,allowDraw:!0,allowResize:!0,brushComponent:i().createElement(l,null),brushStyle:{stroke:"transparent",fill:"black",fillOpacity:.1},handleComponent:i().createElement(l,null),handleStyle:{stroke:"transparent",fill:"transparent"},handleWidth:8,mouseMoveThreshold:0},$=t=>{const e={...V,...t},{children:r}=e,o=t=>{const{handleWidth:r,handleStyle:o,handleComponent:a,name:u}=e,s=N.getDomainBox(e,t),{x1:c,x2:l,y1:f,y2:h}=s,{top:x,bottom:y,left:p,right:d}=N.getHandles(e,s),m=Math.abs(l-c)||1,v=Math.abs(h-f)||1,g=a.props&&a.props.style||{},b=n()({},g,o),M=(()=>{const t={yProps:"ns-resize",xProps:"ew-resize"};return!e.allowResize&&e.allowDrag?(t.xProps="move",t.yProps="move"):e.allowResize||e.allowDrag||(t.xProps="auto",t.yProps="auto"),t})(),w={style:b,width:m,height:r,cursor:M.yProps},D={style:b,width:r,height:v,cursor:M.xProps},B={top:x&&Object.assign({x:x.x1,y:x.y1},w),bottom:y&&Object.assign({x:y.x1,y:y.y1},w),left:p&&Object.assign({y:p.y1,x:p.x1},D),right:d&&Object.assign({y:d.y1,x:d.x1},D)},O=["top","bottom","left","right"].reduce(((t,n)=>B[n]?t.concat(i().cloneElement(a,Object.assign({key:`${u}-handle-${n}`},B[n]))):t),[]);return O.length?O:null};return{props:e,children:[...i().Children.toArray(r),...(()=>{const{currentDomain:t,cachedBrushDomain:r}=e,a=n()({},e.brushDomain,e.domain),u=_()(a,r)?n()({},t,a):a,s=(t=>{const{x:r,y:o}=t,{brushStyle:a,brushComponent:u,name:s}=e,c=u.props&&u.props.style,l=e.allowDrag||e.allowResize?"move":"auto";return r[0]!==r[1]&&o[0]!==o[1]?i().cloneElement(u,{key:`${s}-brush`,width:Math.abs(r[1]-r[0])||1,height:Math.abs(o[1]-o[0])||1,x:Math.min(r[0],r[1]),y:Math.min(o[0],o[1]),cursor:l,style:n()({},c,a)}):null})(v(e,u));return s?[s,o(u)]:[]})()]}},k=t=>{const{props:n,children:e}=$(t);return i().createElement(R,n,e)};k.role="container",k.defaultEvents=t=>{const n={...V,...t},e=(t,e)=>(r,o,i,a)=>n.disable||e?.(o)?{}:t(r,{...n,...o},i,a);return[{target:"parent",eventHandlers:{onMouseDown:e(N.onMouseDown),onTouchStart:e(N.onMouseDown),onGlobalMouseMove:e(N.onGlobalMouseMove,(t=>!t.isPanning&&!t.isSelecting)),onGlobalTouchMove:e(N.onGlobalMouseMove,(t=>!t.isPanning&&!t.isSelecting)),onGlobalMouseUp:e(N.onGlobalMouseUp),onGlobalTouchEnd:e(N.onGlobalMouseUp),onGlobalTouchCancel:e(N.onGlobalMouseUp)}}]}}(),o}()}));
|
|
1
|
+
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("react")):"function"==typeof define&&define.amd?define(["react"],n):"object"==typeof exports?exports.VictoryBrushContainer=n(require("react")):t.VictoryBrushContainer=n(t.React)}(self,(function(t){return function(){var n={2596:function(t,n,e){var r=e(2373).Symbol;t.exports=r},6082:function(t){t.exports=function(t,n,e){switch(e.length){case 0:return t.call(n);case 1:return t.call(n,e[0]);case 2:return t.call(n,e[0],e[1]);case 3:return t.call(n,e[0],e[1],e[2])}return t.apply(n,e)}},8644:function(t){t.exports=function(t,n){for(var e=-1,r=null==t?0:t.length,o=Array(r);++e<r;)o[e]=n(t[e],e,t);return o}},9559:function(t){t.exports=function(t,n){for(var e=-1,r=n.length,o=t.length;++e<r;)t[o+e]=n[e];return t}},4132:function(t,n,e){var r=e(8347),o=e(788),i=Object.prototype.hasOwnProperty;t.exports=function(t,n,e){var a=t[n];i.call(t,n)&&o(a,e)&&(void 0!==e||n in t)||r(t,n,e)}},8347:function(t,n,e){var r=e(5525);t.exports=function(t,n,e){"__proto__"==n&&r?r(t,n,{configurable:!0,enumerable:!0,value:e,writable:!0}):t[n]=e}},6457:function(t,n,e){var r=e(9559),o=e(3608);t.exports=function t(n,e,i,a,u){var s=-1,c=n.length;for(i||(i=o),u||(u=[]);++s<c;){var l=n[s];e>0&&i(l)?e>1?t(l,e-1,i,a,u):r(u,l):a||(u[u.length]=l)}return u}},4432:function(t,n,e){var r=e(9026),o=e(3110);t.exports=function(t,n){for(var e=0,i=(n=r(n,t)).length;null!=t&&e<i;)t=t[o(n[e++])];return e&&e==i?t:void 0}},6776:function(t){t.exports=function(t,n){return null!=t&&n in Object(t)}},5436:function(t,n,e){var r=e(6371),o=e(5066);t.exports=function(t,n){return r(t,n,(function(n,e){return o(t,e)}))}},6371:function(t,n,e){var r=e(4432),o=e(6539),i=e(9026);t.exports=function(t,n,e){for(var a=-1,u=n.length,s={};++a<u;){var c=n[a],l=r(t,c);e(l,c)&&o(s,i(c,t),l)}return s}},1600:function(t){t.exports=function(t){return function(n){return null==n?void 0:n[t]}}},3301:function(t,n,e){var r=e(4432);t.exports=function(t){return function(n){return r(n,t)}}},6317:function(t,n,e){var r=e(5346),o=e(4280),i=e(201);t.exports=function(t,n){return i(o(t,n,r),t+"")}},6539:function(t,n,e){var r=e(4132),o=e(9026),i=e(9099),a=e(7709),u=e(3110);t.exports=function(t,n,e,s){if(!a(t))return t;for(var c=-1,l=(n=o(n,t)).length,f=l-1,h=t;null!=h&&++c<l;){var x=u(n[c]),y=e;if("__proto__"===x||"constructor"===x||"prototype"===x)return t;if(c!=f){var p=h[x];void 0===(y=s?s(p,x,h):void 0)&&(y=a(p)?p:i(n[c+1])?[]:{})}r(h,x,y),h=h[x]}return t}},6316:function(t,n,e){var r=e(2596),o=e(8644),i=e(163),a=e(1995),u=r?r.prototype:void 0,s=u?u.toString:void 0;t.exports=function t(n){if("string"==typeof n)return n;if(i(n))return o(n,t)+"";if(a(n))return s?s.call(n):"";var e=n+"";return"0"==e&&1/n==-1/0?"-0":e}},9026:function(t,n,e){var r=e(163),o=e(726),i=e(7801),a=e(7010);t.exports=function(t,n){return r(t)?t:o(t,n)?[t]:i(a(t))}},5525:function(t,n,e){var r=e(3743),o=function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},5557:function(t,n,e){var r=e(2645),o=e(4280),i=e(201);t.exports=function(t){return i(o(t,void 0,r),t+"")}},2117:function(t,n,e){var r="object"==typeof e.g&&e.g&&e.g.Object===Object&&e.g;t.exports=r},3743:function(t){t.exports=function(t,n){return null==t?void 0:t[n]}},3096:function(t,n,e){var r=e(9026),o=e(5075),i=e(163),a=e(9099),u=e(8454),s=e(3110);t.exports=function(t,n,e){for(var c=-1,l=(n=r(n,t)).length,f=!1;++c<l;){var h=s(n[c]);if(!(f=null!=t&&e(t,h)))break;t=t[h]}return f||++c!=l?f:!!(l=null==t?0:t.length)&&u(l)&&a(h,l)&&(i(t)||o(t))}},3608:function(t,n,e){var r=e(2596),o=e(5075),i=e(163),a=r?r.isConcatSpreadable:void 0;t.exports=function(t){return i(t)||o(t)||!!(a&&t&&t[a])}},9099:function(t){var n=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&n.test(t))&&t>-1&&t%1==0&&t<e}},8286:function(t){t.exports=function(){return!1}},726:function(t,n,e){var r=e(163),o=e(1995),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;t.exports=function(t,n){if(r(t))return!1;var e=typeof t;return!("number"!=e&&"symbol"!=e&&"boolean"!=e&&null!=t&&!o(t))||a.test(t)||!i.test(t)||null!=n&&t in Object(n)}},2453:function(t){t.exports=function(t){return t}},4280:function(t,n,e){var r=e(6082),o=Math.max;t.exports=function(t,n,e){return n=o(void 0===n?t.length-1:n,0),function(){for(var i=arguments,a=-1,u=o(i.length-n,0),s=Array(u);++a<u;)s[a]=i[n+a];a=-1;for(var c=Array(n+1);++a<n;)c[a]=i[a];return c[n]=e(s),r(t,this,c)}}},2373:function(t,n,e){var r=e(2117),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();t.exports=i},201:function(t){t.exports=function(t){return t}},7801:function(t,n,e){var r=e(2453),o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,a=r((function(t){var n=[];return 46===t.charCodeAt(0)&&n.push(""),t.replace(o,(function(t,e,r,o){n.push(r?o.replace(i,"$1"):e||t)})),n}));t.exports=a},3110:function(t,n,e){var r=e(1995);t.exports=function(t){if("string"==typeof t||r(t))return t;var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}},5034:function(t,n,e){var r=e(7709),o=e(6987),i=e(5812),a=Math.max,u=Math.min;t.exports=function(t,n,e){var s,c,l,f,h,x,y=0,p=!1,d=!1,m=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function v(n){var e=s,r=c;return s=c=void 0,y=n,f=t.apply(r,e)}function g(t){return y=t,h=setTimeout(M,n),p?v(t):f}function b(t){var e=t-x;return void 0===x||e>=n||e<0||d&&t-y>=l}function M(){var t=o();if(b(t))return w(t);h=setTimeout(M,function(t){var e=n-(t-x);return d?u(e,l-(t-y)):e}(t))}function w(t){return h=void 0,m&&s?v(t):(s=c=void 0,f)}function D(){var t=o(),e=b(t);if(s=arguments,c=this,x=t,e){if(void 0===h)return g(x);if(d)return clearTimeout(h),h=setTimeout(M,n),v(x)}return void 0===h&&(h=setTimeout(M,n)),f}return n=i(n)||0,r(e)&&(p=!!e.leading,l=(d="maxWait"in e)?a(i(e.maxWait)||0,n):l,m="trailing"in e?!!e.trailing:m),D.cancel=function(){void 0!==h&&clearTimeout(h),y=0,s=x=c=h=void 0},D.flush=function(){return void 0===h?f:w(o())},D}},1893:function(t,n,e){var r=e(6317),o=e(788),i=e(8286),a=e(8855),u=Object.prototype,s=u.hasOwnProperty,c=r((function(t,n){t=Object(t);var e=-1,r=n.length,c=r>2?n[2]:void 0;for(c&&i(n[0],n[1],c)&&(r=1);++e<r;)for(var l=n[e],f=a(l),h=-1,x=f.length;++h<x;){var y=f[h],p=t[y];(void 0===p||o(p,u[y])&&!s.call(t,y))&&(t[y]=l[y])}return t}));t.exports=c},788:function(t){t.exports=function(t,n){return t===n||t!=t&&n!=n}},2645:function(t,n,e){var r=e(6457);t.exports=function(t){return null!=t&&t.length?r(t,1):[]}},5066:function(t,n,e){var r=e(6776),o=e(3096);t.exports=function(t,n){return null!=t&&o(t,n,r)}},5346:function(t){t.exports=function(t){return t}},5075:function(t){t.exports=function(){return!1}},163:function(t){var n=Array.isArray;t.exports=n},8454:function(t){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},7709:function(t){t.exports=function(t){var n=typeof t;return null!=t&&("object"==n||"function"==n)}},1995:function(t){t.exports=function(){return!1}},8855:function(t){t.exports=function(t){var n=[];if(null!=t)for(var e in Object(t))n.push(e);return n}},6987:function(t,n,e){var r=e(2373);t.exports=function(){return r.Date.now()}},9082:function(t,n,e){var r=e(5436),o=e(5557)((function(t,n){return null==t?{}:r(t,n)}));t.exports=o},8532:function(t,n,e){var r=e(1600),o=e(3301),i=e(726),a=e(3110);t.exports=function(t){return i(t)?r(a(t)):o(t)}},8163:function(t,n,e){var r=e(5034),o=e(7709);t.exports=function(t,n,e){var i=!0,a=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return o(e)&&(i="leading"in e?!!e.leading:i,a="trailing"in e?!!e.trailing:a),r(t,n,{leading:i,maxWait:n,trailing:a})}},5812:function(t){t.exports=function(t){return t}},7010:function(t,n,e){var r=e(6316);t.exports=function(t){return null==t?"":r(t)}},660:function(t,n,e){var r=e(7010),o=0;t.exports=function(t){var n=++o;return r(t)+n}},7491:function(t){var n="undefined"!=typeof Element,e="function"==typeof Map,r="function"==typeof Set,o="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function i(t,a){if(t===a)return!0;if(t&&a&&"object"==typeof t&&"object"==typeof a){if(t.constructor!==a.constructor)return!1;var u,s,c,l;if(Array.isArray(t)){if((u=t.length)!=a.length)return!1;for(s=u;0!=s--;)if(!i(t[s],a[s]))return!1;return!0}if(e&&t instanceof Map&&a instanceof Map){if(t.size!==a.size)return!1;for(l=t.entries();!(s=l.next()).done;)if(!a.has(s.value[0]))return!1;for(l=t.entries();!(s=l.next()).done;)if(!i(s.value[1],a.get(s.value[0])))return!1;return!0}if(r&&t instanceof Set&&a instanceof Set){if(t.size!==a.size)return!1;for(l=t.entries();!(s=l.next()).done;)if(!a.has(s.value[0]))return!1;return!0}if(o&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(a)){if((u=t.length)!=a.length)return!1;for(s=u;0!=s--;)if(t[s]!==a[s])return!1;return!0}if(t.constructor===RegExp)return t.source===a.source&&t.flags===a.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===a.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===a.toString();if((u=(c=Object.keys(t)).length)!==Object.keys(a).length)return!1;for(s=u;0!=s--;)if(!Object.prototype.hasOwnProperty.call(a,c[s]))return!1;if(n&&t instanceof Element)return!1;for(s=u;0!=s--;)if(("_owner"!==c[s]&&"__v"!==c[s]&&"__o"!==c[s]||!t.$$typeof)&&!i(t[c[s]],a[c[s]]))return!1;return!0}return t!=t&&a!=a}t.exports=function(t,n){try{return i(t,n)}catch(t){if((t.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw t}}},9787:function(n){"use strict";n.exports=t}},e={};function r(t){var o=e[t];if(void 0!==o)return o.exports;var i=e[t]={exports:{}};return n[t](i,i.exports,r),i.exports}r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,{a:n}),n},r.d=function(t,n){for(var e in n)r.o(n,e)&&!r.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return function(){"use strict";r.r(o),r.d(o,{BrushHelpers:function(){return N},VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS:function(){return V},VictoryBrushContainer:function(){return k},useVictoryBrushContainer:function(){return $}});var t=r(9787),n=r.n(t),e=r(1893),i=r.n(e);function a(t,n){return u(t)?t(n):t}function u(t){return"function"==typeof t}function s(t,n){if(t)return Object.keys(t).reduce(((e,r)=>(e[r]=n(t[r]),e)),{})}function c(){return c=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},c.apply(this,arguments)}r(8532),r(9082);const l=(0,t.forwardRef)(((t,e)=>{const{desc:r,id:o,tabIndex:i,origin:u,...s}=t,l={vectorEffect:"non-scaling-stroke",id:a(o,t)?.toString(),tabIndex:a(i,t),...s};return r?n().createElement("rect",c({},l,{ref:e}),n().createElement("desc",null,r)):n().createElement("rect",c({},l,{ref:e}))}));function f(t){return Array.isArray(t)&&t.some((t=>t instanceof Date))}function h(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];const o=t.concat(e);return f(o)?new Date(Math.max(...o)):Math.max(...o)}function x(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];const o=t.concat(e);return f(o)?new Date(Math.min(...o)):Math.min(...o)}function y(t,n,e){const{a:r,d:o,e:i,f:a}=n;return"y"===e?o*t+a:r*t+i}function p(t){return!(!t||void 0===t.identifier)}function d(t){if(p(t.nativeEvent))return;const n=t=>"svg"===t.nodeName?t:t.parentNode?n(t.parentNode):t;return n(t.target)}function m(t,n){if(p(t.nativeEvent))return{x:t.nativeEvent.locationX,y:t.nativeEvent.locationY};const e=function(t){return t.changedTouches&&t.changedTouches.length>0}(t)?t.changedTouches[0]:t,r=function(t){return t.getScreenCTM().inverse()}(n||d(e));return{x:y(e.clientX,r,"x"),y:y(e.clientY,r,"y")}}function v(t,n){const{horizontal:e}=t,r=t.scale,o=n||{x:r.x.domain(),y:r.y.domain()};return{x:e?[r.y(o.y[0]),r.y(o.y[1])]:[r.x(o.x[0]),r.x(o.x[1])],y:e?[r.x(o.x[0]),r.x(o.x[1])]:[r.y(o.y[0]),r.y(o.y[1])]}}function g(t,n,e,r){const{polar:o,horizontal:i}=t;if(!o)return{x:i?n.x.invert(r):n.x.invert(e),y:i?n.y.invert(e):n.y.invert(r)};const a=t.origin||{x:0,y:0},u=e-a.x,s=r-a.y,c=Math.abs(u*Math.sqrt(1+Math.pow(-s/u,2))),l=(-Math.atan2(s,u)+2*Math.PI)%(2*Math.PI);return{x:n.x.invert(l),y:n.y.invert(c)}}function b(t){const{x1:n,x2:e,y1:r,y2:o,scale:i}=t,a=g(t,i,n,r),u=g(t,i,e,o),s=(t,n)=>[x([t,n]),h([t,n])];return{x:s(a.x,u.x),y:s(a.y,u.y)}}var M=r(660),w=r.n(M);function D(){return D=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},D.apply(this,arguments)}const B=n().forwardRef(((t,e)=>n().createElement("svg",D({ref:e},t)))),O={startsWith:["data-","aria-"],exactMatch:[]},E=t=>{const n={...t};return Object.fromEntries(Object.entries(n).filter((t=>{let[n]=t;return(t=>!(!(t=>{let n=!1;return O.startsWith.forEach((e=>{new RegExp(`\\b(${e})(\\w|-)+`,"g").test(t)&&(n=!0)})),n})(t)&&!(t=>O.exactMatch.includes(t))(t)))(n)})).map((n=>{let[e,r]=n;return[e,a(r,t)]})))},j=n().createContext(void 0);j.displayName="PortalContext";const S=t=>{let{children:e}=t;const[r,o]=n().useState(new Map),i=n().useCallback(((t,n)=>{o((e=>{const r=new Map(e);return r.set(t,n),r}))}),[o]),a=n().useCallback((t=>{o((n=>{const e=new Map(n);return e.delete(t),e}))}),[o]),u=n().useMemo((()=>({addChild:i,removeChild:a,children:r})),[i,a,r]);return n().createElement(j.Provider,{value:u},e)},A=t=>{let{as:e,...r}=t;const o=n().useContext(j);if(!o)return null;const i=Array.from(o.children.values());return n().cloneElement(e,r,i)};function P(){return P=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},P.apply(this,arguments)}const C={className:"VictoryContainer",portalComponent:n().createElement(B,null),portalZIndex:99,responsive:!0,role:"img"},R=e=>{const{role:r,title:o,desc:i,children:a,className:s,portalZIndex:c,portalComponent:l,width:f,height:h,style:x,tabIndex:y,responsive:p,events:d,ouiaId:m,ouiaSafe:v,ouiaType:g,dimensions:b,ariaDescribedBy:M,ariaLabelledBy:D,viewBox:B,preserveAspectRatio:O,userProps:j,titleId:R,descId:T,containerRef:G,localContainerRef:z}=function(n){const e={...C,...n},{title:r,desc:o,width:i,height:a,responsive:u}=e,s=(0,t.useRef)(null),c=(0,t.useRef)(w()("victory-container-")),l=e.containerId??c.current,f=t=>`${l}-${t}`,h=E(e),x=u?{width:"100%",height:"100%"}:{width:i,height:a},y=u?`0 0 ${i} ${a}`:void 0,p=u?e.preserveAspectRatio:void 0,d=[r&&f("title"),e["aria-labelledby"]].filter(Boolean).join(" ")||void 0,m=[o&&f("desc"),e["aria-describedby"]].filter(Boolean).join(" ")||void 0,v=f("title"),g=f("desc");return{...e,titleId:v,descId:g,dimensions:x,viewBox:y,preserveAspectRatio:p,ariaLabelledBy:d,ariaDescribedBy:m,userProps:h,localContainerRef:s}}(e);return n().useEffect((()=>{if(!d?.onWheel)return;const t=t=>t.preventDefault(),n=z?.current;return n?.addEventListener("wheel",t),()=>{n?.removeEventListener("wheel",t)}}),[]),n().createElement("div",{className:s,style:{...x,width:p?x?.width:b.width,height:p?x?.height:b.height,pointerEvents:x?.pointerEvents??"none",touchAction:x?.touchAction??"none",position:x?.position??"relative"},"data-ouia-component-id":m,"data-ouia-component-type":g,"data-ouia-safe":v,ref:(_=[z,G],t=>{_.forEach((n=>{u(n)?n(t):null!=n&&(n.current=t)}))})},n().createElement(S,null,n().createElement("svg",P({width:f,height:h,tabIndex:y,role:r,"aria-labelledby":D,"aria-describedby":M,viewBox:B,preserveAspectRatio:O,style:{...b,pointerEvents:"all"}},j,d),o?n().createElement("title",{id:R},o):null,i?n().createElement("desc",{id:T},i):null,a),n().createElement("div",{style:{...b,zIndex:c,position:"absolute",top:0,left:0}},n().createElement(A,{as:l,width:f,height:h,viewBox:B,preserveAspectRatio:O,style:{...b,overflow:"visible"}}))));var _};R.role="container";var T=r(8163),G=r.n(T),z=r(7491),_=r.n(z);const I={getDimension(t){const{horizontal:n,brushDimension:e}=t;return n&&e?"x"===e?"y":"x":e},withinBounds(t,n,e){const{x1:r,x2:o,y1:i,y2:a}=s(n,Number),{x:u,y:c}=s(t,Number),l=e?e/2:0;return u+l>=Math.min(r,o)&&u-l<=Math.max(r,o)&&c+l>=Math.min(i,a)&&c-l<=Math.max(i,a)},getDomainBox(t,n,e){const r=this.getDimension(t),o=i()({},n,t.domain),a=i()({},e,o),u=v(t,o),s=v(t,a);return{x1:"y"!==r?Math.min(...s.x):Math.min(...u.x),x2:"y"!==r?Math.max(...s.x):Math.max(...u.x),y1:"x"!==r?Math.min(...s.y):Math.min(...u.y),y2:"x"!==r?Math.max(...s.y):Math.max(...u.y)}},getHandles(t,n){const e=this.getDimension(t),{x1:r,x2:o,y1:i,y2:a}=n,u=Math.min(r,o),s=Math.max(r,o),c=Math.min(i,a),l=Math.max(i,a),f=t.handleWidth/2;return{left:"y"!==e&&{x1:u-f,x2:u+f,y1:i,y2:a},right:"y"!==e&&{x1:s-f,x2:s+f,y1:i,y2:a},top:"x"!==e&&{x1:r,x2:o,y1:c-f,y2:c+f},bottom:"x"!==e&&{x1:r,x2:o,y1:l-f,y2:l+f}}},getActiveHandles(t,n,e){const r=this.getHandles(n,e),o=["top","bottom","left","right"].reduce(((n,e)=>r[e]&&this.withinBounds(t,r[e])?n.concat(e):n),[]);return o.length&&o},getResizeMutation(t,n){const{x1:e,y1:r,x2:o,y2:i}=t,a={left:{x1:Math.max(e,o),x2:Math.min(e,o),y1:r,y2:i},right:{x1:Math.min(e,o),x2:Math.max(e,o),y1:r,y2:i},top:{y1:Math.max(r,i),y2:Math.min(r,i),x1:e,x2:o},bottom:{y1:Math.min(r,i),y2:Math.max(r,i),x1:e,x2:o}};return n.reduce(((t,n)=>Object.assign(t,a[n])),{})},getMinimumDomain:()=>({x:[0,1/Number.MAX_SAFE_INTEGER],y:[0,1/Number.MAX_SAFE_INTEGER]}),getDefaultBrushArea(t,n,e){const{domain:r,fullDomain:o,scale:i,horizontal:a,allowResize:u}=t,s=u||t.defaultBrushArea?t.defaultBrushArea:"move";if("none"===s)return this.getMinimumDomain();if("disable"===s)return n;if("move"===s){const r=this.getDomainBox(t,o,n),u=t.parentSVG||d(e),s=this.panBox({...t,...r,brushDomain:n,startX:(r.x1+r.x2)/2,startY:(r.y1+r.y2)/2},m(e,u)),c=t.fullDomainBox||this.getDomainBox(t,o);return b({...this.constrainBox(s,c),scale:i,horizontal:a})}return r},getSelectionMutation(t,n,e){const{x:r,y:o}=t,{x1:i,x2:a,y1:u,y2:s}=n;return{x1:"y"!==e?r:i,y1:"x"!==e?o:u,x2:"y"!==e?r:a,y2:"x"!==e?o:s}},panBox(t,n){const{domain:e,startX:r,startY:o}=t,a=this.getDimension(t),u=i()({},t.brushDomain,e),s=i()({},t.fullDomain,e),{x1:c,x2:l,y1:f,y2:h}=t.x1?t:this.getDomainBox(t,s,u),{x:x,y:y}=n,p=r?r-x:0,d=o?o-y:0;return{x1:"y"!==a?Math.min(c,l)-p:Math.min(c,l),x2:"y"!==a?Math.max(c,l)-p:Math.max(c,l),y1:"x"!==a?Math.min(f,h)-d:Math.min(f,h),y2:"x"!==a?Math.max(f,h)-d:Math.max(f,h)}},constrainBox(t,n){const{x1:e,y1:r,x2:o,y2:i}=s(n,Number);return{x1:t.x2>o?o-Math.abs(t.x2-t.x1):Math.max(t.x1,e),y1:t.y2>i?i-Math.abs(t.y2-t.y1):Math.max(t.y1,r),x2:t.x1<e?e+Math.abs(t.x2-t.x1):Math.min(t.x2,o),y2:t.y1<r?r+Math.abs(t.y2-t.y1):Math.min(t.y2,i)}},constrainPoint(t,n){const{x1:e,y1:r,x2:o,y2:i}=s(n,Number);return{x:Math.min(Math.max(t.x,e),o),y:Math.min(Math.max(t.y,r),i)}},hasMoved(t){const{x1:n,x2:e,y1:r,y2:o,mouseMoveThreshold:i}=t,a=this.getDimension(t),u=Math.abs(n-e)>=i,s=Math.abs(r-o)>=i;switch(a){case"x":return u;case"y":return s;default:return u||s}},onMouseDown(t,n){t.preventDefault();const{handleWidth:e,cachedBrushDomain:r,domain:o,allowResize:a,allowDrag:u,allowDraw:s}=n,c=this.getDimension(n),l=a||n.defaultBrushArea?n.defaultBrushArea:"move";if(!a&&!u)return{};const f=n.fullDomainBox||this.getDomainBox(n,o),h=n.parentSVG||d(t),{x:x,y:y}=m(t,h);if(!this.withinBounds({x:x,y:y},f,e))return{};const p=i()({},n.brushDomain,o),v=_()(p,r)?n.currentDomain||p||o:p||o,g=this.getDomainBox(n,o,v),b=a&&this.getActiveHandles({x:x,y:y},n,g);return b?[{target:"parent",mutation:()=>({isSelecting:!0,domainBox:g,fullDomainBox:f,cachedBrushDomain:p,currentDomain:v,parentSVG:h,...this.getResizeMutation(g,b)})}]:this.withinBounds({x:x,y:y},g)&&!_()(o,v)?[{target:"parent",mutation:()=>({isPanning:u,startX:x,startY:y,domainBox:g,fullDomainBox:f,currentDomain:v,cachedBrushDomain:p,parentSVG:h,...g})}]:s?[{target:"parent",mutation:()=>({isSelecting:a||"move"===l,domainBox:g,fullDomainBox:f,parentSVG:h,cachedBrushDomain:p,cachedCurrentDomain:v,currentDomain:this.getMinimumDomain(),...this.getSelectionMutation({x:x,y:y},g,c)})}]:{}},onGlobalMouseMove(t,n){const{scale:e,isPanning:r,isSelecting:o,fullDomainBox:a,onBrushDomainChange:s,allowResize:c,allowDrag:l,horizontal:f,mouseMoveThreshold:h,parentSVG:x}=n,y=this.getDimension(n),{x:p,y:d}=m(t,x);if(!c&&!l||h>0&&!this.hasMoved({...n,x2:p,y2:d}))return{};if(l&&r){const{startX:t,startY:r}=n,o=this.panBox(n,{x:p,y:d}),c=this.constrainBox(o,a),l=b({...c,scale:e,horizontal:f}),h={currentDomain:l,parentSVG:x,startX:o.x2>=a.x2||o.x1<=a.x1?t:p,startY:o.y2>=a.y2||o.y1<=a.y1?r:d,...c};return u(s)&&s(l,i()({},h,n)),[{target:"parent",mutation:()=>h}]}if(c&&o){const{x:t,y:r}=this.constrainPoint({x:"y"!==y?p:n.x2,y:"x"!==y?d:n.y2},a),o=b({x2:t,y2:r,x1:n.x1,y1:n.y1,scale:e,horizontal:f}),c={x2:t,y2:r,currentDomain:o,parentSVG:x};return u(s)&&s(o,i()({},c,n)),[{target:"parent",mutation:()=>c}]}return{}},onGlobalMouseUp(t,n){if(!n.isPanning&&!n.isSelecting)return{};const{x1:e,y1:r,x2:o,y2:a,isPanning:s,isSelecting:c,onBrushDomainChange:l,onBrushDomainChangeEnd:f,onBrushCleared:h,currentDomain:x,allowResize:y,allowDrag:p}=n,d=y||n.defaultBrushArea?n.defaultBrushArea:"move",m={isPanning:!1,isSelecting:!1};if(!y&&(void 0===d||"none"===d)||e!==o&&r!==a)(p&&s||y&&c)&&u(f)&&f(x,i()({},m,n));else{const e=n.cachedCurrentDomain||x,r=this.getDefaultBrushArea(n,e,t);m.currentDomain=r,u(l)&&l(r,i()({},m,n)),u(f)&&f(r,i()({},m,n)),u(h)&&h(r,i()({},m,n))}return[{target:"parent",mutation:()=>m}]}},N={...I,onMouseDown:I.onMouseDown.bind(I),onGlobalMouseUp:I.onGlobalMouseUp.bind(I),onGlobalMouseMove:G()(I.onGlobalMouseMove.bind(I),16,{leading:!0,trailing:!1})},V={allowDrag:!0,allowDraw:!0,allowResize:!0,brushComponent:n().createElement(l,null),brushStyle:{stroke:"transparent",fill:"black",fillOpacity:.1},handleComponent:n().createElement(l,null),handleStyle:{stroke:"transparent",fill:"transparent"},handleWidth:8,mouseMoveThreshold:0},$=t=>{const e={...V,...t},{children:r}=e,o=t=>{const{handleWidth:r,handleStyle:o,handleComponent:a,name:u}=e,s=N.getDomainBox(e,t),{x1:c,x2:l,y1:f,y2:h}=s,{top:x,bottom:y,left:p,right:d}=N.getHandles(e,s),m=Math.abs(l-c)||1,v=Math.abs(h-f)||1,g=a.props&&a.props.style||{},b=i()({},g,o),M=(()=>{const t={yProps:"ns-resize",xProps:"ew-resize"};return!e.allowResize&&e.allowDrag?(t.xProps="move",t.yProps="move"):e.allowResize||e.allowDrag||(t.xProps="auto",t.yProps="auto"),t})(),w={style:b,width:m,height:r,cursor:M.yProps},D={style:b,width:r,height:v,cursor:M.xProps},B={top:x&&Object.assign({x:x.x1,y:x.y1},w),bottom:y&&Object.assign({x:y.x1,y:y.y1},w),left:p&&Object.assign({y:p.y1,x:p.x1},D),right:d&&Object.assign({y:d.y1,x:d.x1},D)},O=["top","bottom","left","right"].reduce(((t,e)=>B[e]?t.concat(n().cloneElement(a,Object.assign({key:`${u}-handle-${e}`},B[e]))):t),[]);return O.length?O:null};return{props:e,children:[...n().Children.toArray(r),...(()=>{const{currentDomain:t,cachedBrushDomain:r}=e,a=i()({},e.brushDomain,e.domain),u=_()(a,r)?i()({},t,a):a,s=(t=>{const{x:r,y:o}=t,{brushStyle:a,brushComponent:u,name:s}=e,c=u.props&&u.props.style,l=e.allowDrag||e.allowResize?"move":"auto";return r[0]!==r[1]&&o[0]!==o[1]?n().cloneElement(u,{key:`${s}-brush`,width:Math.abs(r[1]-r[0])||1,height:Math.abs(o[1]-o[0])||1,x:Math.min(r[0],r[1]),y:Math.min(o[0],o[1]),cursor:l,style:i()({},c,a)}):null})(v(e,u));return s?[s,o(u)]:[]})()]}},k=t=>{const{props:e,children:r}=$(t);return n().createElement(R,e,r)};k.role="container",k.defaultEvents=t=>{const n={...V,...t},e=(t,e)=>(r,o,i,a)=>n.disable||e?.(o)?{}:t(r,{...n,...o},i,a);return[{target:"parent",eventHandlers:{onMouseDown:e(N.onMouseDown),onTouchStart:e(N.onMouseDown),onGlobalMouseMove:e(N.onGlobalMouseMove,(t=>!t.isPanning&&!t.isSelecting)),onGlobalTouchMove:e(N.onGlobalMouseMove,(t=>!t.isPanning&&!t.isSelecting)),onGlobalMouseUp:e(N.onGlobalMouseUp),onGlobalTouchEnd:e(N.onGlobalMouseUp),onGlobalTouchCancel:e(N.onGlobalMouseUp)}}]}}(),o}()}));
|
|
2
2
|
//# sourceMappingURL=victory-brush-container.min.js.map
|
package/es/brush-helpers.d.ts
CHANGED
package/es/brush-helpers.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import defaults from "lodash/defaults";
|
|
2
|
+
import throttle from "lodash/throttle";
|
|
3
3
|
import { Helpers as CoreHelpers, Selection } from "victory-core";
|
|
4
4
|
import isEqual from "react-fast-compare";
|
|
5
5
|
const Helpers = {
|
|
@@ -29,8 +29,8 @@ const Helpers = {
|
|
|
29
29
|
},
|
|
30
30
|
getDomainBox(props, fullDomain, selectedDomain) {
|
|
31
31
|
const brushDimension = this.getDimension(props);
|
|
32
|
-
const fullDomainObject =
|
|
33
|
-
const selectedDomainObject =
|
|
32
|
+
const fullDomainObject = defaults({}, fullDomain, props.domain);
|
|
33
|
+
const selectedDomainObject = defaults({}, selectedDomain, fullDomainObject);
|
|
34
34
|
const fullCoords = Selection.getDomainCoordinates(props, fullDomainObject);
|
|
35
35
|
const selectedCoords = Selection.getDomainCoordinates(props, selectedDomainObject);
|
|
36
36
|
return {
|
|
@@ -186,8 +186,8 @@ const Helpers = {
|
|
|
186
186
|
startY
|
|
187
187
|
} = props;
|
|
188
188
|
const brushDimension = this.getDimension(props);
|
|
189
|
-
const brushDomain =
|
|
190
|
-
const fullDomain =
|
|
189
|
+
const brushDomain = defaults({}, props.brushDomain, domain);
|
|
190
|
+
const fullDomain = defaults({}, props.fullDomain, domain);
|
|
191
191
|
const {
|
|
192
192
|
x1,
|
|
193
193
|
x2,
|
|
@@ -284,7 +284,7 @@ const Helpers = {
|
|
|
284
284
|
}, fullDomainBox, handleWidth)) {
|
|
285
285
|
return {};
|
|
286
286
|
}
|
|
287
|
-
const brushDomain =
|
|
287
|
+
const brushDomain = defaults({}, targetProps.brushDomain, domain);
|
|
288
288
|
const currentDomain = isEqual(brushDomain, cachedBrushDomain) ? targetProps.currentDomain || brushDomain || domain : brushDomain || domain;
|
|
289
289
|
const domainBox = this.getDomainBox(targetProps, domain, currentDomain);
|
|
290
290
|
const activeHandles = allowResize && this.getActiveHandles({
|
|
@@ -395,7 +395,7 @@ const Helpers = {
|
|
|
395
395
|
...constrainedBox
|
|
396
396
|
};
|
|
397
397
|
if (CoreHelpers.isFunction(onBrushDomainChange)) {
|
|
398
|
-
onBrushDomainChange(currentDomain,
|
|
398
|
+
onBrushDomainChange(currentDomain, defaults({}, mutatedProps, targetProps));
|
|
399
399
|
}
|
|
400
400
|
return [{
|
|
401
401
|
target: "parent",
|
|
@@ -424,7 +424,7 @@ const Helpers = {
|
|
|
424
424
|
parentSVG
|
|
425
425
|
};
|
|
426
426
|
if (CoreHelpers.isFunction(onBrushDomainChange)) {
|
|
427
|
-
onBrushDomainChange(currentDomain,
|
|
427
|
+
onBrushDomainChange(currentDomain, defaults({}, mutatedProps, targetProps));
|
|
428
428
|
}
|
|
429
429
|
return [{
|
|
430
430
|
target: "parent",
|
|
@@ -465,17 +465,17 @@ const Helpers = {
|
|
|
465
465
|
const defaultDomain = this.getDefaultBrushArea(targetProps, cachedDomain, evt);
|
|
466
466
|
mutatedProps.currentDomain = defaultDomain;
|
|
467
467
|
if (CoreHelpers.isFunction(onBrushDomainChange)) {
|
|
468
|
-
onBrushDomainChange(defaultDomain,
|
|
468
|
+
onBrushDomainChange(defaultDomain, defaults({}, mutatedProps, targetProps));
|
|
469
469
|
}
|
|
470
470
|
if (CoreHelpers.isFunction(onBrushDomainChangeEnd)) {
|
|
471
|
-
onBrushDomainChangeEnd(defaultDomain,
|
|
471
|
+
onBrushDomainChangeEnd(defaultDomain, defaults({}, mutatedProps, targetProps));
|
|
472
472
|
}
|
|
473
473
|
if (CoreHelpers.isFunction(onBrushCleared)) {
|
|
474
|
-
onBrushCleared(defaultDomain,
|
|
474
|
+
onBrushCleared(defaultDomain, defaults({}, mutatedProps, targetProps));
|
|
475
475
|
}
|
|
476
476
|
} else if (allowDrag && isPanning || allowResize && isSelecting) {
|
|
477
477
|
if (CoreHelpers.isFunction(onBrushDomainChangeEnd)) {
|
|
478
|
-
onBrushDomainChangeEnd(currentDomain,
|
|
478
|
+
onBrushDomainChangeEnd(currentDomain, defaults({}, mutatedProps, targetProps));
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
481
|
return [{
|
|
@@ -488,7 +488,7 @@ export const BrushHelpers = {
|
|
|
488
488
|
...Helpers,
|
|
489
489
|
onMouseDown: Helpers.onMouseDown.bind(Helpers),
|
|
490
490
|
onGlobalMouseUp: Helpers.onGlobalMouseUp.bind(Helpers),
|
|
491
|
-
onGlobalMouseMove:
|
|
491
|
+
onGlobalMouseMove: throttle(Helpers.onGlobalMouseMove.bind(Helpers), 16,
|
|
492
492
|
// eslint-disable-line no-magic-numbers
|
|
493
493
|
{
|
|
494
494
|
leading: true,
|
|
@@ -65,68 +65,68 @@ export declare const useVictoryBrushContainer: (initialProps: VictoryBrushContai
|
|
|
65
65
|
allowDraw: boolean;
|
|
66
66
|
allowResize: boolean;
|
|
67
67
|
brushComponent: JSX.Element;
|
|
68
|
-
brushDimension?: "x" | "y"
|
|
68
|
+
brushDimension?: "x" | "y";
|
|
69
69
|
brushDomain?: {
|
|
70
|
-
x?: DomainTuple
|
|
71
|
-
y?: DomainTuple
|
|
72
|
-
}
|
|
70
|
+
x?: DomainTuple;
|
|
71
|
+
y?: DomainTuple;
|
|
72
|
+
};
|
|
73
73
|
brushStyle: React.CSSProperties | {
|
|
74
74
|
stroke: string;
|
|
75
75
|
fill: string;
|
|
76
76
|
fillOpacity: number;
|
|
77
77
|
};
|
|
78
|
-
defaultBrushArea?: "
|
|
79
|
-
disable?: boolean
|
|
78
|
+
defaultBrushArea?: "all" | "none" | "disable" | "move";
|
|
79
|
+
disable?: boolean;
|
|
80
80
|
handleComponent: JSX.Element;
|
|
81
81
|
handleStyle: React.CSSProperties | {
|
|
82
82
|
stroke: string;
|
|
83
83
|
fill: string;
|
|
84
84
|
};
|
|
85
85
|
handleWidth: number;
|
|
86
|
-
onBrushCleared?: (
|
|
86
|
+
onBrushCleared?: (domain: {
|
|
87
87
|
x: DomainTuple;
|
|
88
88
|
y: DomainTuple;
|
|
89
|
-
}, props: VictoryBrushContainerProps) => void
|
|
90
|
-
onBrushDomainChange?: (
|
|
89
|
+
}, props: VictoryBrushContainerProps) => void;
|
|
90
|
+
onBrushDomainChange?: (domain: {
|
|
91
91
|
x: DomainTuple;
|
|
92
92
|
y: DomainTuple;
|
|
93
|
-
}, props: VictoryBrushContainerProps) => void
|
|
94
|
-
onBrushDomainChangeEnd?: (
|
|
93
|
+
}, props: VictoryBrushContainerProps) => void;
|
|
94
|
+
onBrushDomainChangeEnd?: (domain: {
|
|
95
95
|
x: DomainTuple;
|
|
96
96
|
y: DomainTuple;
|
|
97
|
-
}, props: VictoryBrushContainerProps) => void
|
|
98
|
-
"aria-describedby"?: string
|
|
99
|
-
"aria-labelledby"?: string
|
|
100
|
-
children?: React.ReactElement
|
|
101
|
-
className?: string
|
|
102
|
-
containerId?:
|
|
103
|
-
containerRef?: React.Ref<HTMLElement
|
|
104
|
-
desc?: string
|
|
105
|
-
events?: React.DOMAttributes<any
|
|
106
|
-
height?: number
|
|
107
|
-
name?: string
|
|
108
|
-
origin?: import("victory-core").OriginType
|
|
109
|
-
polar?: boolean
|
|
110
|
-
portalComponent?: React.ReactElement
|
|
111
|
-
portalZIndex?: number
|
|
112
|
-
preserveAspectRatio?: string
|
|
113
|
-
responsive?: boolean
|
|
114
|
-
role?: string
|
|
97
|
+
}, props: VictoryBrushContainerProps) => void;
|
|
98
|
+
"aria-describedby"?: string;
|
|
99
|
+
"aria-labelledby"?: string;
|
|
100
|
+
children?: React.ReactElement | React.ReactElement[];
|
|
101
|
+
className?: string;
|
|
102
|
+
containerId?: number | string;
|
|
103
|
+
containerRef?: React.Ref<HTMLElement>;
|
|
104
|
+
desc?: string;
|
|
105
|
+
events?: React.DOMAttributes<any>;
|
|
106
|
+
height?: number;
|
|
107
|
+
name?: string;
|
|
108
|
+
origin?: import("victory-core").OriginType;
|
|
109
|
+
polar?: boolean;
|
|
110
|
+
portalComponent?: React.ReactElement;
|
|
111
|
+
portalZIndex?: number;
|
|
112
|
+
preserveAspectRatio?: string;
|
|
113
|
+
responsive?: boolean;
|
|
114
|
+
role?: string;
|
|
115
115
|
scale?: {
|
|
116
|
-
x?: import("victory-core").D3Scale
|
|
117
|
-
y?: import("victory-core").D3Scale
|
|
118
|
-
}
|
|
119
|
-
style?: React.CSSProperties
|
|
120
|
-
tabIndex?: number
|
|
121
|
-
theme?: import("victory-core").VictoryThemeDefinition
|
|
122
|
-
title?: string
|
|
123
|
-
width?: number
|
|
124
|
-
ouiaId?:
|
|
125
|
-
ouiaSafe?: boolean
|
|
126
|
-
ouiaType?: string
|
|
116
|
+
x?: import("victory-core").D3Scale;
|
|
117
|
+
y?: import("victory-core").D3Scale;
|
|
118
|
+
};
|
|
119
|
+
style?: React.CSSProperties;
|
|
120
|
+
tabIndex?: number;
|
|
121
|
+
theme?: import("victory-core").VictoryThemeDefinition;
|
|
122
|
+
title?: string;
|
|
123
|
+
width?: number;
|
|
124
|
+
ouiaId?: number | string;
|
|
125
|
+
ouiaSafe?: boolean;
|
|
126
|
+
ouiaType?: string;
|
|
127
127
|
mouseMoveThreshold: number;
|
|
128
128
|
};
|
|
129
|
-
children: React.ReactElement
|
|
129
|
+
children: React.ReactElement[];
|
|
130
130
|
};
|
|
131
131
|
export declare const VictoryBrushContainer: {
|
|
132
132
|
(initialProps: VictoryBrushContainerProps): JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import _defaults from "lodash/defaults";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import { Selection, Rect, VictoryContainer } from "victory-core";
|
|
4
3
|
import { BrushHelpers } from "./brush-helpers";
|
|
4
|
+
import defaults from "lodash/defaults";
|
|
5
5
|
import isEqual from "react-fast-compare";
|
|
6
6
|
export const VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS = {
|
|
7
7
|
allowDrag: true,
|
|
@@ -48,7 +48,7 @@ export const useVictoryBrushContainer = initialProps => {
|
|
|
48
48
|
x: Math.min(x[0], x[1]),
|
|
49
49
|
y: Math.min(y[0], y[1]),
|
|
50
50
|
cursor,
|
|
51
|
-
style:
|
|
51
|
+
style: defaults({}, brushComponentStyle, brushStyle)
|
|
52
52
|
}) : null;
|
|
53
53
|
};
|
|
54
54
|
const getCursorPointers = () => {
|
|
@@ -88,7 +88,7 @@ export const useVictoryBrushContainer = initialProps => {
|
|
|
88
88
|
const width = Math.abs(x2 - x1) || 1;
|
|
89
89
|
const height = Math.abs(y2 - y1) || 1;
|
|
90
90
|
const handleComponentStyle = handleComponent.props && handleComponent.props.style || {};
|
|
91
|
-
const style =
|
|
91
|
+
const style = defaults({}, handleComponentStyle, handleStyle);
|
|
92
92
|
const cursors = getCursorPointers();
|
|
93
93
|
const yProps = {
|
|
94
94
|
style,
|
|
@@ -130,8 +130,8 @@ export const useVictoryBrushContainer = initialProps => {
|
|
|
130
130
|
currentDomain,
|
|
131
131
|
cachedBrushDomain
|
|
132
132
|
} = props;
|
|
133
|
-
const brushDomain =
|
|
134
|
-
const domain = isEqual(brushDomain, cachedBrushDomain) ?
|
|
133
|
+
const brushDomain = defaults({}, props.brushDomain, props.domain);
|
|
134
|
+
const domain = isEqual(brushDomain, cachedBrushDomain) ? defaults({}, currentDomain, brushDomain) : brushDomain;
|
|
135
135
|
const coordinates = Selection.getDomainCoordinates(props, domain);
|
|
136
136
|
const selectBox = getSelectBox(coordinates);
|
|
137
137
|
return selectBox ? [selectBox, getHandles(domain)] : [];
|
package/lib/brush-helpers.d.ts
CHANGED
package/lib/brush-helpers.js
CHANGED
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.BrushHelpers = void 0;
|
|
7
|
-
var
|
|
8
|
-
var
|
|
7
|
+
var _defaults = _interopRequireDefault(require("lodash/defaults"));
|
|
8
|
+
var _throttle = _interopRequireDefault(require("lodash/throttle"));
|
|
9
9
|
var _victoryCore = require("victory-core");
|
|
10
10
|
var _reactFastCompare = _interopRequireDefault(require("react-fast-compare"));
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -36,8 +36,8 @@ const Helpers = {
|
|
|
36
36
|
},
|
|
37
37
|
getDomainBox(props, fullDomain, selectedDomain) {
|
|
38
38
|
const brushDimension = this.getDimension(props);
|
|
39
|
-
const fullDomainObject = (0,
|
|
40
|
-
const selectedDomainObject = (0,
|
|
39
|
+
const fullDomainObject = (0, _defaults.default)({}, fullDomain, props.domain);
|
|
40
|
+
const selectedDomainObject = (0, _defaults.default)({}, selectedDomain, fullDomainObject);
|
|
41
41
|
const fullCoords = _victoryCore.Selection.getDomainCoordinates(props, fullDomainObject);
|
|
42
42
|
const selectedCoords = _victoryCore.Selection.getDomainCoordinates(props, selectedDomainObject);
|
|
43
43
|
return {
|
|
@@ -193,8 +193,8 @@ const Helpers = {
|
|
|
193
193
|
startY
|
|
194
194
|
} = props;
|
|
195
195
|
const brushDimension = this.getDimension(props);
|
|
196
|
-
const brushDomain = (0,
|
|
197
|
-
const fullDomain = (0,
|
|
196
|
+
const brushDomain = (0, _defaults.default)({}, props.brushDomain, domain);
|
|
197
|
+
const fullDomain = (0, _defaults.default)({}, props.fullDomain, domain);
|
|
198
198
|
const {
|
|
199
199
|
x1,
|
|
200
200
|
x2,
|
|
@@ -291,7 +291,7 @@ const Helpers = {
|
|
|
291
291
|
}, fullDomainBox, handleWidth)) {
|
|
292
292
|
return {};
|
|
293
293
|
}
|
|
294
|
-
const brushDomain = (0,
|
|
294
|
+
const brushDomain = (0, _defaults.default)({}, targetProps.brushDomain, domain);
|
|
295
295
|
const currentDomain = (0, _reactFastCompare.default)(brushDomain, cachedBrushDomain) ? targetProps.currentDomain || brushDomain || domain : brushDomain || domain;
|
|
296
296
|
const domainBox = this.getDomainBox(targetProps, domain, currentDomain);
|
|
297
297
|
const activeHandles = allowResize && this.getActiveHandles({
|
|
@@ -402,7 +402,7 @@ const Helpers = {
|
|
|
402
402
|
...constrainedBox
|
|
403
403
|
};
|
|
404
404
|
if (_victoryCore.Helpers.isFunction(onBrushDomainChange)) {
|
|
405
|
-
onBrushDomainChange(currentDomain, (0,
|
|
405
|
+
onBrushDomainChange(currentDomain, (0, _defaults.default)({}, mutatedProps, targetProps));
|
|
406
406
|
}
|
|
407
407
|
return [{
|
|
408
408
|
target: "parent",
|
|
@@ -431,7 +431,7 @@ const Helpers = {
|
|
|
431
431
|
parentSVG
|
|
432
432
|
};
|
|
433
433
|
if (_victoryCore.Helpers.isFunction(onBrushDomainChange)) {
|
|
434
|
-
onBrushDomainChange(currentDomain, (0,
|
|
434
|
+
onBrushDomainChange(currentDomain, (0, _defaults.default)({}, mutatedProps, targetProps));
|
|
435
435
|
}
|
|
436
436
|
return [{
|
|
437
437
|
target: "parent",
|
|
@@ -472,17 +472,17 @@ const Helpers = {
|
|
|
472
472
|
const defaultDomain = this.getDefaultBrushArea(targetProps, cachedDomain, evt);
|
|
473
473
|
mutatedProps.currentDomain = defaultDomain;
|
|
474
474
|
if (_victoryCore.Helpers.isFunction(onBrushDomainChange)) {
|
|
475
|
-
onBrushDomainChange(defaultDomain, (0,
|
|
475
|
+
onBrushDomainChange(defaultDomain, (0, _defaults.default)({}, mutatedProps, targetProps));
|
|
476
476
|
}
|
|
477
477
|
if (_victoryCore.Helpers.isFunction(onBrushDomainChangeEnd)) {
|
|
478
|
-
onBrushDomainChangeEnd(defaultDomain, (0,
|
|
478
|
+
onBrushDomainChangeEnd(defaultDomain, (0, _defaults.default)({}, mutatedProps, targetProps));
|
|
479
479
|
}
|
|
480
480
|
if (_victoryCore.Helpers.isFunction(onBrushCleared)) {
|
|
481
|
-
onBrushCleared(defaultDomain, (0,
|
|
481
|
+
onBrushCleared(defaultDomain, (0, _defaults.default)({}, mutatedProps, targetProps));
|
|
482
482
|
}
|
|
483
483
|
} else if (allowDrag && isPanning || allowResize && isSelecting) {
|
|
484
484
|
if (_victoryCore.Helpers.isFunction(onBrushDomainChangeEnd)) {
|
|
485
|
-
onBrushDomainChangeEnd(currentDomain, (0,
|
|
485
|
+
onBrushDomainChangeEnd(currentDomain, (0, _defaults.default)({}, mutatedProps, targetProps));
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
488
|
return [{
|
|
@@ -495,7 +495,7 @@ const BrushHelpers = exports.BrushHelpers = {
|
|
|
495
495
|
...Helpers,
|
|
496
496
|
onMouseDown: Helpers.onMouseDown.bind(Helpers),
|
|
497
497
|
onGlobalMouseUp: Helpers.onGlobalMouseUp.bind(Helpers),
|
|
498
|
-
onGlobalMouseMove: (0,
|
|
498
|
+
onGlobalMouseMove: (0, _throttle.default)(Helpers.onGlobalMouseMove.bind(Helpers), 16,
|
|
499
499
|
// eslint-disable-line no-magic-numbers
|
|
500
500
|
{
|
|
501
501
|
leading: true,
|
|
@@ -65,68 +65,68 @@ export declare const useVictoryBrushContainer: (initialProps: VictoryBrushContai
|
|
|
65
65
|
allowDraw: boolean;
|
|
66
66
|
allowResize: boolean;
|
|
67
67
|
brushComponent: JSX.Element;
|
|
68
|
-
brushDimension?: "x" | "y"
|
|
68
|
+
brushDimension?: "x" | "y";
|
|
69
69
|
brushDomain?: {
|
|
70
|
-
x?: DomainTuple
|
|
71
|
-
y?: DomainTuple
|
|
72
|
-
}
|
|
70
|
+
x?: DomainTuple;
|
|
71
|
+
y?: DomainTuple;
|
|
72
|
+
};
|
|
73
73
|
brushStyle: React.CSSProperties | {
|
|
74
74
|
stroke: string;
|
|
75
75
|
fill: string;
|
|
76
76
|
fillOpacity: number;
|
|
77
77
|
};
|
|
78
|
-
defaultBrushArea?: "
|
|
79
|
-
disable?: boolean
|
|
78
|
+
defaultBrushArea?: "all" | "none" | "disable" | "move";
|
|
79
|
+
disable?: boolean;
|
|
80
80
|
handleComponent: JSX.Element;
|
|
81
81
|
handleStyle: React.CSSProperties | {
|
|
82
82
|
stroke: string;
|
|
83
83
|
fill: string;
|
|
84
84
|
};
|
|
85
85
|
handleWidth: number;
|
|
86
|
-
onBrushCleared?: (
|
|
86
|
+
onBrushCleared?: (domain: {
|
|
87
87
|
x: DomainTuple;
|
|
88
88
|
y: DomainTuple;
|
|
89
|
-
}, props: VictoryBrushContainerProps) => void
|
|
90
|
-
onBrushDomainChange?: (
|
|
89
|
+
}, props: VictoryBrushContainerProps) => void;
|
|
90
|
+
onBrushDomainChange?: (domain: {
|
|
91
91
|
x: DomainTuple;
|
|
92
92
|
y: DomainTuple;
|
|
93
|
-
}, props: VictoryBrushContainerProps) => void
|
|
94
|
-
onBrushDomainChangeEnd?: (
|
|
93
|
+
}, props: VictoryBrushContainerProps) => void;
|
|
94
|
+
onBrushDomainChangeEnd?: (domain: {
|
|
95
95
|
x: DomainTuple;
|
|
96
96
|
y: DomainTuple;
|
|
97
|
-
}, props: VictoryBrushContainerProps) => void
|
|
98
|
-
"aria-describedby"?: string
|
|
99
|
-
"aria-labelledby"?: string
|
|
100
|
-
children?: React.ReactElement
|
|
101
|
-
className?: string
|
|
102
|
-
containerId?:
|
|
103
|
-
containerRef?: React.Ref<HTMLElement
|
|
104
|
-
desc?: string
|
|
105
|
-
events?: React.DOMAttributes<any
|
|
106
|
-
height?: number
|
|
107
|
-
name?: string
|
|
108
|
-
origin?: import("victory-core").OriginType
|
|
109
|
-
polar?: boolean
|
|
110
|
-
portalComponent?: React.ReactElement
|
|
111
|
-
portalZIndex?: number
|
|
112
|
-
preserveAspectRatio?: string
|
|
113
|
-
responsive?: boolean
|
|
114
|
-
role?: string
|
|
97
|
+
}, props: VictoryBrushContainerProps) => void;
|
|
98
|
+
"aria-describedby"?: string;
|
|
99
|
+
"aria-labelledby"?: string;
|
|
100
|
+
children?: React.ReactElement | React.ReactElement[];
|
|
101
|
+
className?: string;
|
|
102
|
+
containerId?: number | string;
|
|
103
|
+
containerRef?: React.Ref<HTMLElement>;
|
|
104
|
+
desc?: string;
|
|
105
|
+
events?: React.DOMAttributes<any>;
|
|
106
|
+
height?: number;
|
|
107
|
+
name?: string;
|
|
108
|
+
origin?: import("victory-core").OriginType;
|
|
109
|
+
polar?: boolean;
|
|
110
|
+
portalComponent?: React.ReactElement;
|
|
111
|
+
portalZIndex?: number;
|
|
112
|
+
preserveAspectRatio?: string;
|
|
113
|
+
responsive?: boolean;
|
|
114
|
+
role?: string;
|
|
115
115
|
scale?: {
|
|
116
|
-
x?: import("victory-core").D3Scale
|
|
117
|
-
y?: import("victory-core").D3Scale
|
|
118
|
-
}
|
|
119
|
-
style?: React.CSSProperties
|
|
120
|
-
tabIndex?: number
|
|
121
|
-
theme?: import("victory-core").VictoryThemeDefinition
|
|
122
|
-
title?: string
|
|
123
|
-
width?: number
|
|
124
|
-
ouiaId?:
|
|
125
|
-
ouiaSafe?: boolean
|
|
126
|
-
ouiaType?: string
|
|
116
|
+
x?: import("victory-core").D3Scale;
|
|
117
|
+
y?: import("victory-core").D3Scale;
|
|
118
|
+
};
|
|
119
|
+
style?: React.CSSProperties;
|
|
120
|
+
tabIndex?: number;
|
|
121
|
+
theme?: import("victory-core").VictoryThemeDefinition;
|
|
122
|
+
title?: string;
|
|
123
|
+
width?: number;
|
|
124
|
+
ouiaId?: number | string;
|
|
125
|
+
ouiaSafe?: boolean;
|
|
126
|
+
ouiaType?: string;
|
|
127
127
|
mouseMoveThreshold: number;
|
|
128
128
|
};
|
|
129
|
-
children: React.ReactElement
|
|
129
|
+
children: React.ReactElement[];
|
|
130
130
|
};
|
|
131
131
|
export declare const VictoryBrushContainer: {
|
|
132
132
|
(initialProps: VictoryBrushContainerProps): JSX.Element;
|
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useVictoryBrushContainer = exports.VictoryBrushContainer = exports.VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS = void 0;
|
|
7
|
-
var _defaults2 = _interopRequireDefault(require("lodash/defaults"));
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
8
|
var _victoryCore = require("victory-core");
|
|
10
9
|
var _brushHelpers = require("./brush-helpers");
|
|
10
|
+
var _defaults = _interopRequireDefault(require("lodash/defaults"));
|
|
11
11
|
var _reactFastCompare = _interopRequireDefault(require("react-fast-compare"));
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
const VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS = exports.VICTORY_BRUSH_CONTAINER_DEFAULT_PROPS = {
|
|
@@ -55,7 +55,7 @@ const useVictoryBrushContainer = initialProps => {
|
|
|
55
55
|
x: Math.min(x[0], x[1]),
|
|
56
56
|
y: Math.min(y[0], y[1]),
|
|
57
57
|
cursor,
|
|
58
|
-
style: (0,
|
|
58
|
+
style: (0, _defaults.default)({}, brushComponentStyle, brushStyle)
|
|
59
59
|
}) : null;
|
|
60
60
|
};
|
|
61
61
|
const getCursorPointers = () => {
|
|
@@ -95,7 +95,7 @@ const useVictoryBrushContainer = initialProps => {
|
|
|
95
95
|
const width = Math.abs(x2 - x1) || 1;
|
|
96
96
|
const height = Math.abs(y2 - y1) || 1;
|
|
97
97
|
const handleComponentStyle = handleComponent.props && handleComponent.props.style || {};
|
|
98
|
-
const style = (0,
|
|
98
|
+
const style = (0, _defaults.default)({}, handleComponentStyle, handleStyle);
|
|
99
99
|
const cursors = getCursorPointers();
|
|
100
100
|
const yProps = {
|
|
101
101
|
style,
|
|
@@ -137,8 +137,8 @@ const useVictoryBrushContainer = initialProps => {
|
|
|
137
137
|
currentDomain,
|
|
138
138
|
cachedBrushDomain
|
|
139
139
|
} = props;
|
|
140
|
-
const brushDomain = (0,
|
|
141
|
-
const domain = (0, _reactFastCompare.default)(brushDomain, cachedBrushDomain) ? (0,
|
|
140
|
+
const brushDomain = (0, _defaults.default)({}, props.brushDomain, props.domain);
|
|
141
|
+
const domain = (0, _reactFastCompare.default)(brushDomain, cachedBrushDomain) ? (0, _defaults.default)({}, currentDomain, brushDomain) : brushDomain;
|
|
142
142
|
const coordinates = _victoryCore.Selection.getDomainCoordinates(props, domain);
|
|
143
143
|
const selectBox = getSelectBox(coordinates);
|
|
144
144
|
return selectBox ? [selectBox, getHandles(domain)] : [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "victory-brush-container",
|
|
3
|
-
"version": "37.3.
|
|
3
|
+
"version": "37.3.3",
|
|
4
4
|
"description": "Interactive Brush Component for Victory",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data visualization",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"lodash": "^4.17.19",
|
|
24
24
|
"react-fast-compare": "^3.2.0",
|
|
25
|
-
"victory-core": "37.3.
|
|
25
|
+
"victory-core": "37.3.3"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"react": ">=16.6.0"
|
|
@@ -181,32 +181,6 @@
|
|
|
181
181
|
"pnpm-lock.yaml"
|
|
182
182
|
]
|
|
183
183
|
},
|
|
184
|
-
"format": {
|
|
185
|
-
"command": "nps format:pkg",
|
|
186
|
-
"files": [
|
|
187
|
-
"src/**",
|
|
188
|
-
"*.json",
|
|
189
|
-
"../../.prettierignore",
|
|
190
|
-
"../../.prettierrc.json"
|
|
191
|
-
],
|
|
192
|
-
"output": [],
|
|
193
|
-
"packageLocks": [
|
|
194
|
-
"pnpm-lock.yaml"
|
|
195
|
-
]
|
|
196
|
-
},
|
|
197
|
-
"format:fix": {
|
|
198
|
-
"command": "pnpm run format || nps format:pkg:fix",
|
|
199
|
-
"files": [
|
|
200
|
-
"src/**",
|
|
201
|
-
"*.json",
|
|
202
|
-
"../../.prettierignore",
|
|
203
|
-
"../../.prettierrc.json"
|
|
204
|
-
],
|
|
205
|
-
"output": [],
|
|
206
|
-
"packageLocks": [
|
|
207
|
-
"pnpm-lock.yaml"
|
|
208
|
-
]
|
|
209
|
-
},
|
|
210
184
|
"lint": {
|
|
211
185
|
"command": "eslint src",
|
|
212
186
|
"files": [
|
|
@@ -269,8 +243,6 @@
|
|
|
269
243
|
"check": "wireit",
|
|
270
244
|
"types:check": "wireit",
|
|
271
245
|
"types:create": "wireit",
|
|
272
|
-
"format": "wireit",
|
|
273
|
-
"format:fix": "wireit",
|
|
274
246
|
"lint": "wireit",
|
|
275
247
|
"lint:fix": "wireit",
|
|
276
248
|
"jest": "wireit"
|
package/src/brush-helpers.ts
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
VictoryEventHandler,
|
|
9
9
|
} from "victory-core";
|
|
10
10
|
import { BrushHelpers } from "./brush-helpers";
|
|
11
|
-
import
|
|
11
|
+
import defaults from "lodash/defaults";
|
|
12
12
|
import isEqual from "react-fast-compare";
|
|
13
13
|
|
|
14
14
|
export interface VictoryBrushContainerProps extends VictoryContainerProps {
|