@evergis/charts 2.0.63 → 2.0.64
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.
|
@@ -1987,7 +1987,7 @@ const barChartClassNames = /*#__PURE__*/_extends({
|
|
|
1987
1987
|
barChartGridLineY: 'barChartGridLineY',
|
|
1988
1988
|
barChartSelection: 'barChartSelection'
|
|
1989
1989
|
}, tooltipClassnames, labelClassnames, barChartLinesClassNames);
|
|
1990
|
-
const SvgWrapper$4 = /*#__PURE__*/styled__default(Wrapper)(_templateObject$a || (_templateObject$a = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: ", ";\n user-select: ", ";\n cursor: ", ";\n \n line {\n stroke-width: 1px;\n shape-rendering: crispEdges;\n }\n \n .", ",\n .", " {\n stroke: rgba(48, 69, 79, 0.06);\n }\n \n .", " {\n }\n \n .", " {\n fill: none;\n pointer-events: all;\n }\n \n .", " {\n stroke-width: 1.5px;\n stroke-linejoin: round;\n stroke-linecap: round;\n }\n \n .", " {\n shape-rendering: auto;\n }\n \n .", " {\n fill-opacity: 0.24;\n }\n \n .", " {\n position: absolute;\n top: 0;\n width: 0;\n background: rgba(0, 170, 255, 0.06);\n box-shadow: 1px 0 0 #00AAFF, -1px 0 0 #00AAFF;\n pointer-events: none;\n }\n"])), _ref => {
|
|
1990
|
+
const SvgWrapper$4 = /*#__PURE__*/styled__default(Wrapper)(_templateObject$a || (_templateObject$a = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: ", ";\n user-select: ", ";\n cursor: ", ";\n width: ", ";\n \n line {\n stroke-width: 1px;\n shape-rendering: crispEdges;\n }\n \n .", ",\n .", " {\n stroke: rgba(48, 69, 79, 0.06);\n }\n \n .", " {\n }\n \n .", " {\n fill: none;\n pointer-events: all;\n }\n \n .", " {\n stroke-width: 1.5px;\n stroke-linejoin: round;\n stroke-linecap: round;\n }\n \n .", " {\n shape-rendering: auto;\n }\n \n .", " {\n fill-opacity: 0.24;\n }\n \n .", " {\n position: absolute;\n top: 0;\n width: 0;\n background: rgba(0, 170, 255, 0.06);\n box-shadow: 1px 0 0 #00AAFF, -1px 0 0 #00AAFF;\n pointer-events: none;\n }\n"])), _ref => {
|
|
1991
1991
|
let {
|
|
1992
1992
|
selectable
|
|
1993
1993
|
} = _ref;
|
|
@@ -2002,6 +2002,11 @@ const SvgWrapper$4 = /*#__PURE__*/styled__default(Wrapper)(_templateObject$a ||
|
|
|
2002
2002
|
selectable
|
|
2003
2003
|
} = _ref3;
|
|
2004
2004
|
return selectable && "crosshair";
|
|
2005
|
+
}, _ref4 => {
|
|
2006
|
+
let {
|
|
2007
|
+
selectable
|
|
2008
|
+
} = _ref4;
|
|
2009
|
+
return selectable && "auto";
|
|
2005
2010
|
}, barChartClassNames.barChartGridLineX, barChartClassNames.barChartGridLineY, barChartClassNames.barChartMouseRect, barChartClassNames.barChartMouseRect, barChartClassNames.barChartLinesGlobal, barChartClassNames.barChartLine, barChartClassNames.barChartArea, barChartClassNames.barChartSelection);
|
|
2006
2011
|
const TooltipStyles$1 = /*#__PURE__*/styled.createGlobalStyle(_templateObject2$4 || (_templateObject2$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n .", " {\n z-index: 1;\n transition: all linear 144ms;\n\n .", " {\n margin-bottom: 4px;\n :last-of-type {\n margin-bottom: 0;\n }\n }\n }\n"])), barChartClassNames.barChartMouseTooltip, barChartClassNames.barChartTooltipItem);
|
|
2007
2012
|
|
|
@@ -2054,7 +2059,7 @@ const useSelection = (node, props) => {
|
|
|
2054
2059
|
}
|
|
2055
2060
|
}
|
|
2056
2061
|
}, [node]);
|
|
2057
|
-
const
|
|
2062
|
+
const onMouseLeave = React.useCallback(e => {
|
|
2058
2063
|
if (drawing.current && node) {
|
|
2059
2064
|
if (node.offsetLeft > e.pageX) {
|
|
2060
2065
|
const nodeWidth = node.firstChild.getBoundingClientRect().width;
|
|
@@ -2062,11 +2067,16 @@ const useSelection = (node, props) => {
|
|
|
2062
2067
|
selection.style.width = startX.current + "px";
|
|
2063
2068
|
selection.style.marginLeft = "-" + startX.current + "px";
|
|
2064
2069
|
}
|
|
2070
|
+
|
|
2071
|
+
if (node.offsetLeft + node.offsetWidth < e.pageX) {
|
|
2072
|
+
const nodeWidth = node.firstChild.getBoundingClientRect().width;
|
|
2073
|
+
selection.style.left = startX.current + "px";
|
|
2074
|
+
selection.style.width = nodeWidth - startX.current + "px";
|
|
2075
|
+
selection.style.marginLeft = "0px";
|
|
2076
|
+
}
|
|
2065
2077
|
}
|
|
2066
2078
|
}, [node]);
|
|
2067
|
-
const onStopDrawing = React.useCallback(
|
|
2068
|
-
e.stopPropagation();
|
|
2069
|
-
|
|
2079
|
+
const onStopDrawing = React.useCallback(() => {
|
|
2070
2080
|
if (node) {
|
|
2071
2081
|
const nodeWidth = node.firstChild.getBoundingClientRect().width;
|
|
2072
2082
|
const selectionMinX = selection.offsetLeft >= 0 ? selection.offsetLeft <= nodeWidth ? selection.offsetLeft : nodeWidth : 0;
|
|
@@ -2098,9 +2108,10 @@ const useSelection = (node, props) => {
|
|
|
2098
2108
|
node.addEventListener("touchstart", onStartDrawing);
|
|
2099
2109
|
node.addEventListener("mousemove", onDraw);
|
|
2100
2110
|
node.addEventListener("touchmove", onDraw);
|
|
2101
|
-
|
|
2111
|
+
node.addEventListener("mouseleave", onMouseLeave);
|
|
2112
|
+
node.addEventListener("mouseup", onStopDrawing);
|
|
2113
|
+
node.addEventListener("touchend", onStopDrawing);
|
|
2102
2114
|
document.addEventListener("mouseup", onStopDrawing);
|
|
2103
|
-
document.addEventListener("touchend", onStopDrawing);
|
|
2104
2115
|
}
|
|
2105
2116
|
|
|
2106
2117
|
return () => {
|
|
@@ -2108,9 +2119,10 @@ const useSelection = (node, props) => {
|
|
|
2108
2119
|
node == null ? void 0 : node.removeEventListener("touchstart", onStartDrawing);
|
|
2109
2120
|
node == null ? void 0 : node.removeEventListener("mousemove", onDraw);
|
|
2110
2121
|
node == null ? void 0 : node.removeEventListener("touchmove", onDraw);
|
|
2111
|
-
|
|
2122
|
+
node == null ? void 0 : node.removeEventListener("mouseleave", onMouseLeave);
|
|
2123
|
+
node == null ? void 0 : node.removeEventListener("mouseup", onStopDrawing);
|
|
2124
|
+
node == null ? void 0 : node.removeEventListener("touchend", onStopDrawing);
|
|
2112
2125
|
document.removeEventListener("mouseup", onStopDrawing);
|
|
2113
|
-
document.removeEventListener("touchend", onStopDrawing);
|
|
2114
2126
|
};
|
|
2115
2127
|
}, [node]);
|
|
2116
2128
|
};
|