@elliemae/ds-dataviz 3.10.3 → 3.11.0-next.2
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/dist/cjs/graphs/Chart/Chart.js.map +2 -2
- package/dist/cjs/graphs/Chart/ChartContext.js.map +1 -1
- package/dist/cjs/graphs/Chart/DataTestIds.js +36 -0
- package/dist/cjs/graphs/Chart/DataTestIds.js.map +7 -0
- package/dist/cjs/graphs/Chart/config/useChart.js +73 -36
- package/dist/cjs/graphs/Chart/config/useChart.js.map +2 -2
- package/dist/cjs/graphs/Chart/config/useGetters.js +5 -4
- package/dist/cjs/graphs/Chart/config/useGetters.js.map +2 -2
- package/dist/cjs/graphs/Chart/config/useInternalMargins.js +8 -3
- package/dist/cjs/graphs/Chart/config/useInternalMargins.js.map +2 -2
- package/dist/cjs/graphs/Chart/config/useKeyboardNavigation.js +2 -2
- package/dist/cjs/graphs/Chart/config/useKeyboardNavigation.js.map +2 -2
- package/dist/cjs/graphs/Chart/config/useScales.js +1 -2
- package/dist/cjs/graphs/Chart/config/useScales.js.map +2 -2
- package/dist/cjs/graphs/Chart/helpers/index.js +1 -1
- package/dist/cjs/graphs/Chart/helpers/index.js.map +2 -2
- package/dist/cjs/graphs/Chart/helpers/useUniqueData.js +8 -15
- package/dist/cjs/graphs/Chart/helpers/useUniqueData.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Axis/Axes.js +2 -4
- package/dist/cjs/graphs/Chart/parts/Axis/Axes.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Axis/AxisBottom.js +5 -3
- package/dist/cjs/graphs/Chart/parts/Axis/AxisBottom.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Axis/AxisLeft.js +4 -1
- package/dist/cjs/graphs/Chart/parts/Axis/AxisLeft.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/ChartContainer.js +58 -27
- package/dist/cjs/graphs/Chart/parts/ChartContainer.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/ClipPaths.js +14 -38
- package/dist/cjs/graphs/Chart/parts/ClipPaths.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Legend/Legend.js +6 -5
- package/dist/cjs/graphs/Chart/parts/Legend/Legend.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Legend/TopLegend.js +3 -3
- package/dist/cjs/graphs/Chart/parts/Legend/TopLegend.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapper.js +1 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapper.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js +3 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scroller/BlurMask.js +26 -5
- package/dist/cjs/graphs/Chart/parts/Scroller/BlurMask.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scroller/Controllers.js +80 -0
- package/dist/cjs/graphs/Chart/parts/Scroller/Controllers.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarX.js +4 -3
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarX.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarY.js +3 -3
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarY.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerX.js +79 -9
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerX.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerY.js +15 -24
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerY.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/SeriesFactory.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/TrendHighlight.js +52 -0
- package/dist/cjs/graphs/Chart/parts/TrendHighlight.js.map +7 -0
- package/dist/cjs/graphs/Chart/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/Bars.js +2 -1
- package/dist/cjs/graphs/Chart/series/Bars.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/HorizontalBars.js +19 -4
- package/dist/cjs/graphs/Chart/series/HorizontalBars.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/HorizontalStackedBars.js +4 -3
- package/dist/cjs/graphs/Chart/series/HorizontalStackedBars.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/Line.js +3 -1
- package/dist/cjs/graphs/Chart/series/Line.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/Point.js +36 -14
- package/dist/cjs/graphs/Chart/series/Point.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/Points.js +12 -15
- package/dist/cjs/graphs/Chart/series/Points.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/Rect.js +17 -2
- package/dist/cjs/graphs/Chart/series/Rect.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/StackedBar.js +5 -4
- package/dist/cjs/graphs/Chart/series/StackedBar.js.map +2 -2
- package/dist/cjs/graphs/Chart/styles.js +3 -0
- package/dist/cjs/graphs/Chart/styles.js.map +2 -2
- package/dist/esm/graphs/Chart/Chart.js.map +2 -2
- package/dist/esm/graphs/Chart/ChartContext.js.map +1 -1
- package/dist/esm/graphs/Chart/DataTestIds.js +10 -0
- package/dist/esm/graphs/Chart/DataTestIds.js.map +7 -0
- package/dist/esm/graphs/Chart/config/useChart.js +74 -37
- package/dist/esm/graphs/Chart/config/useChart.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useGetters.js +5 -4
- package/dist/esm/graphs/Chart/config/useGetters.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useInternalMargins.js +8 -3
- package/dist/esm/graphs/Chart/config/useInternalMargins.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useKeyboardNavigation.js +2 -2
- package/dist/esm/graphs/Chart/config/useKeyboardNavigation.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useScales.js +1 -2
- package/dist/esm/graphs/Chart/config/useScales.js.map +2 -2
- package/dist/esm/graphs/Chart/helpers/index.js +2 -2
- package/dist/esm/graphs/Chart/helpers/index.js.map +2 -2
- package/dist/esm/graphs/Chart/helpers/useUniqueData.js +8 -15
- package/dist/esm/graphs/Chart/helpers/useUniqueData.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Axis/Axes.js +2 -4
- package/dist/esm/graphs/Chart/parts/Axis/Axes.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Axis/AxisBottom.js +5 -3
- package/dist/esm/graphs/Chart/parts/Axis/AxisBottom.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Axis/AxisLeft.js +4 -1
- package/dist/esm/graphs/Chart/parts/Axis/AxisLeft.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/ChartContainer.js +60 -29
- package/dist/esm/graphs/Chart/parts/ChartContainer.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/ClipPaths.js +15 -39
- package/dist/esm/graphs/Chart/parts/ClipPaths.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Legend/Legend.js +6 -5
- package/dist/esm/graphs/Chart/parts/Legend/Legend.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Legend/TopLegend.js +3 -3
- package/dist/esm/graphs/Chart/parts/Legend/TopLegend.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapper.js +1 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapper.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js +3 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scroller/BlurMask.js +26 -5
- package/dist/esm/graphs/Chart/parts/Scroller/BlurMask.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scroller/Controllers.js +54 -0
- package/dist/esm/graphs/Chart/parts/Scroller/Controllers.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarX.js +4 -3
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarX.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarY.js +3 -3
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarY.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerX.js +80 -10
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerX.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerY.js +15 -24
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerY.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/SeriesFactory.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/TrendHighlight.js +26 -0
- package/dist/esm/graphs/Chart/parts/TrendHighlight.js.map +7 -0
- package/dist/esm/graphs/Chart/react-desc-prop-types.js.map +2 -2
- package/dist/esm/graphs/Chart/series/Bars.js +2 -1
- package/dist/esm/graphs/Chart/series/Bars.js.map +2 -2
- package/dist/esm/graphs/Chart/series/HorizontalBars.js +19 -4
- package/dist/esm/graphs/Chart/series/HorizontalBars.js.map +2 -2
- package/dist/esm/graphs/Chart/series/HorizontalStackedBars.js +4 -3
- package/dist/esm/graphs/Chart/series/HorizontalStackedBars.js.map +2 -2
- package/dist/esm/graphs/Chart/series/Line.js +3 -1
- package/dist/esm/graphs/Chart/series/Line.js.map +2 -2
- package/dist/esm/graphs/Chart/series/Point.js +38 -16
- package/dist/esm/graphs/Chart/series/Point.js.map +2 -2
- package/dist/esm/graphs/Chart/series/Points.js +12 -15
- package/dist/esm/graphs/Chart/series/Points.js.map +2 -2
- package/dist/esm/graphs/Chart/series/Rect.js +18 -3
- package/dist/esm/graphs/Chart/series/Rect.js.map +2 -2
- package/dist/esm/graphs/Chart/series/StackedBar.js +5 -4
- package/dist/esm/graphs/Chart/series/StackedBar.js.map +2 -2
- package/dist/esm/graphs/Chart/styles.js +3 -0
- package/dist/esm/graphs/Chart/styles.js.map +2 -2
- package/package.json +8 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useContext, useMemo, useCallback
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useContext, useMemo, useCallback } from "react";
|
|
4
4
|
import { StyledSVGWrapper } from "../styles";
|
|
5
5
|
import { ChartContext } from "../ChartContext";
|
|
6
6
|
import { useKeyboardNavigation } from "../config/useKeyboardNavigation";
|
|
@@ -8,15 +8,24 @@ import { Legend } from "./Legend/Legend";
|
|
|
8
8
|
import { Label } from "./Labels/Label";
|
|
9
9
|
import { BlurMask } from "./Scroller/BlurMask";
|
|
10
10
|
import { ClipPaths } from "./ClipPaths";
|
|
11
|
-
import {
|
|
11
|
+
import { ScrollableContainerX } from "./Scroller/ScrollableContainerX";
|
|
12
|
+
import { ScrollableContainerY } from "./Scroller/ScrollableContainerY";
|
|
13
|
+
import { AxisBottom } from "./Axis/AxisBottom";
|
|
14
|
+
import { AxisRight } from "./Axis/AxisRight";
|
|
15
|
+
import { AxisLeft } from "./Axis/AxisLeft";
|
|
16
|
+
import { SeriesFactory } from "./SeriesFactory";
|
|
17
|
+
import { Scrapper } from "./Scrapper/Scrapper";
|
|
18
|
+
import { VerticalScrapper } from "./Scrapper/VerticalScrapper";
|
|
19
|
+
import { Controllers } from "./Scroller/Controllers";
|
|
12
20
|
const ChartContainer = () => {
|
|
13
21
|
const {
|
|
14
|
-
props: {
|
|
22
|
+
props: { yAxis, xScroll, scrapper, xAxis },
|
|
15
23
|
containerRef,
|
|
16
24
|
activePoint,
|
|
17
25
|
internalMargin,
|
|
18
26
|
setScrapperPosY,
|
|
19
27
|
setScrapperPosX,
|
|
28
|
+
setContainerRef,
|
|
20
29
|
svgRef,
|
|
21
30
|
isGrabbed,
|
|
22
31
|
setIsGrabbed,
|
|
@@ -27,13 +36,12 @@ const ChartContainer = () => {
|
|
|
27
36
|
setXScrollbarPosition,
|
|
28
37
|
xScrollbarPosition,
|
|
29
38
|
containerRatio,
|
|
30
|
-
|
|
39
|
+
lastPosition,
|
|
31
40
|
setIsScrollbarVisible,
|
|
32
|
-
|
|
33
|
-
|
|
41
|
+
width,
|
|
42
|
+
height,
|
|
34
43
|
currentData
|
|
35
44
|
} = useContext(ChartContext);
|
|
36
|
-
const xScroll = xAxis.advanced?.pointSpacing?.value > 1;
|
|
37
45
|
const yScroll = yAxis.advanced?.pointSpacing?.value > 1;
|
|
38
46
|
const { onInputKeyDown, handleOnBlur, handleOnFocus } = useKeyboardNavigation();
|
|
39
47
|
const onMouseEnterHandler = useCallback(() => {
|
|
@@ -51,7 +59,7 @@ const ChartContainer = () => {
|
|
|
51
59
|
return;
|
|
52
60
|
setActivePoint(null);
|
|
53
61
|
if (xScroll) {
|
|
54
|
-
const newPosition =
|
|
62
|
+
const newPosition = lastPosition?.current + e.clientX - startPosition;
|
|
55
63
|
if (newPosition < 0)
|
|
56
64
|
setXScrollbarPosition(0);
|
|
57
65
|
else if (newPosition > innerWidth - innerWidth / containerRatio)
|
|
@@ -60,7 +68,7 @@ const ChartContainer = () => {
|
|
|
60
68
|
setXScrollbarPosition(newPosition);
|
|
61
69
|
}
|
|
62
70
|
if (yScroll) {
|
|
63
|
-
const newPosition =
|
|
71
|
+
const newPosition = lastPosition?.current + e.clientY - startPosition;
|
|
64
72
|
if (newPosition < 0)
|
|
65
73
|
setXScrollbarPosition(0);
|
|
66
74
|
else if (newPosition > innerHeight - innerHeight / containerRatio)
|
|
@@ -74,7 +82,7 @@ const ChartContainer = () => {
|
|
|
74
82
|
setActivePoint,
|
|
75
83
|
xScroll,
|
|
76
84
|
yScroll,
|
|
77
|
-
|
|
85
|
+
lastPosition,
|
|
78
86
|
startPosition,
|
|
79
87
|
setXScrollbarPosition,
|
|
80
88
|
innerWidth,
|
|
@@ -83,24 +91,46 @@ const ChartContainer = () => {
|
|
|
83
91
|
]
|
|
84
92
|
);
|
|
85
93
|
const handleMouseUp = useCallback(() => {
|
|
86
|
-
|
|
94
|
+
lastPosition.current = xScrollbarPosition;
|
|
87
95
|
setIsGrabbed(false);
|
|
88
|
-
}, [
|
|
96
|
+
}, [lastPosition, setIsGrabbed, xScrollbarPosition]);
|
|
89
97
|
const key = useMemo(
|
|
90
|
-
() => `translate(${internalMargin.left},${internalMargin.top},${internalMargin.right})`,
|
|
91
|
-
[internalMargin]
|
|
98
|
+
() => `translate(${width},${internalMargin.left},${internalMargin.top},${internalMargin.right},${internalMargin.bottom})`,
|
|
99
|
+
[internalMargin, width]
|
|
92
100
|
);
|
|
93
|
-
useEffect(() => {
|
|
94
|
-
containerRef?.current?.addEventListener("mousemove", handleMouseMove);
|
|
95
|
-
const container = containerRef?.current;
|
|
96
|
-
return () => {
|
|
97
|
-
container?.removeEventListener("mousemove", handleMouseMove);
|
|
98
|
-
};
|
|
99
|
-
}, [containerRef, handleMouseMove]);
|
|
100
101
|
if (currentData.length === 0)
|
|
101
102
|
return null;
|
|
103
|
+
const render = useMemo(() => {
|
|
104
|
+
if (xScroll || xAxis.advanced?.pointSpacing?.value > 1) {
|
|
105
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
106
|
+
children: [
|
|
107
|
+
/* @__PURE__ */ jsx(AxisRight, {}),
|
|
108
|
+
/* @__PURE__ */ jsx(AxisLeft, {}),
|
|
109
|
+
/* @__PURE__ */ jsx(ScrollableContainerX, {})
|
|
110
|
+
]
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
if (yScroll) {
|
|
114
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
115
|
+
children: [
|
|
116
|
+
/* @__PURE__ */ jsx(AxisBottom, {}),
|
|
117
|
+
/* @__PURE__ */ jsx(ScrollableContainerY, {})
|
|
118
|
+
]
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
122
|
+
children: [
|
|
123
|
+
/* @__PURE__ */ jsx(AxisRight, {}),
|
|
124
|
+
/* @__PURE__ */ jsx(AxisLeft, {}),
|
|
125
|
+
/* @__PURE__ */ jsx(AxisBottom, {}),
|
|
126
|
+
/* @__PURE__ */ jsx(SeriesFactory, {}),
|
|
127
|
+
scrapper?.type === "horizontal" ? /* @__PURE__ */ jsx(Scrapper, {}) : null,
|
|
128
|
+
scrapper?.type === "vertical" ? /* @__PURE__ */ jsx(VerticalScrapper, {}) : null
|
|
129
|
+
]
|
|
130
|
+
});
|
|
131
|
+
}, [scrapper?.type, xAxis.advanced?.pointSpacing?.value, xScroll, yScroll]);
|
|
102
132
|
return /* @__PURE__ */ jsx(StyledSVGWrapper, {
|
|
103
|
-
ref:
|
|
133
|
+
ref: setContainerRef,
|
|
104
134
|
onKeyDown: onInputKeyDown,
|
|
105
135
|
"aria-hidden": "true",
|
|
106
136
|
tabIndex: activePoint ? -1 : 0,
|
|
@@ -108,20 +138,22 @@ const ChartContainer = () => {
|
|
|
108
138
|
onFocus: handleOnFocus,
|
|
109
139
|
onMouseEnter: onMouseEnterHandler,
|
|
110
140
|
onMouseLeave: onMouseLeaveHandler,
|
|
141
|
+
onMouseMove: handleMouseMove,
|
|
111
142
|
onMouseUp: handleMouseUp,
|
|
112
143
|
onMouseDown: (e) => e.preventDefault(),
|
|
113
144
|
isGrabbed,
|
|
114
|
-
|
|
115
|
-
children: /* @__PURE__ */ jsxs("svg", {
|
|
145
|
+
children: width !== 0 ? /* @__PURE__ */ jsxs("svg", {
|
|
116
146
|
ref: svgRef,
|
|
117
147
|
width,
|
|
118
148
|
height,
|
|
119
149
|
children: [
|
|
150
|
+
/* @__PURE__ */ jsx(ClipPaths, {}),
|
|
120
151
|
/* @__PURE__ */ jsx(BlurMask, {}),
|
|
121
152
|
/* @__PURE__ */ jsxs("g", {
|
|
122
153
|
children: [
|
|
123
154
|
/* @__PURE__ */ jsxs("g", {
|
|
124
155
|
children: [
|
|
156
|
+
/* @__PURE__ */ jsx(Controllers, {}),
|
|
125
157
|
/* @__PURE__ */ jsx(Legend, {}),
|
|
126
158
|
/* @__PURE__ */ jsx(Label, {})
|
|
127
159
|
]
|
|
@@ -129,13 +161,12 @@ const ChartContainer = () => {
|
|
|
129
161
|
/* @__PURE__ */ jsx("g", {
|
|
130
162
|
className: "container",
|
|
131
163
|
transform: `translate(${internalMargin.left},${internalMargin.top})`,
|
|
132
|
-
children:
|
|
164
|
+
children: render
|
|
133
165
|
})
|
|
134
166
|
]
|
|
135
|
-
}, key)
|
|
136
|
-
/* @__PURE__ */ jsx(ClipPaths, {})
|
|
167
|
+
}, key)
|
|
137
168
|
]
|
|
138
|
-
})
|
|
169
|
+
}) : null
|
|
139
170
|
});
|
|
140
171
|
};
|
|
141
172
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/graphs/Chart/parts/ChartContainer.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo, useCallback, useEffect } from 'react';\nimport { StyledSVGWrapper } from '../styles';\n\nimport { ChartContext } from '../ChartContext';\nimport { useKeyboardNavigation } from '../config/useKeyboardNavigation';\nimport { Legend } from './Legend/Legend';\nimport { Label } from './Labels/Label';\nimport { BlurMask } from './Scroller/BlurMask';\nimport { ClipPaths } from './ClipPaths';\nimport {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,YAAY,SAAS,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo, useCallback, useEffect } from 'react';\nimport { StyledSVGWrapper } from '../styles';\n\nimport { ChartContext } from '../ChartContext';\nimport { useKeyboardNavigation } from '../config/useKeyboardNavigation';\nimport { Legend } from './Legend/Legend';\nimport { Label } from './Labels/Label';\nimport { BlurMask } from './Scroller/BlurMask';\nimport { ClipPaths } from './ClipPaths';\nimport { ScrollableContainerX } from './Scroller/ScrollableContainerX';\nimport { ScrollableContainerY } from './Scroller/ScrollableContainerY';\n\nimport { AxisBottom } from './Axis/AxisBottom';\nimport { AxisRight } from './Axis/AxisRight';\nimport { AxisLeft } from './Axis/AxisLeft';\nimport { SeriesFactory } from './SeriesFactory';\nimport { Scrapper } from './Scrapper/Scrapper';\nimport { VerticalScrapper } from './Scrapper/VerticalScrapper';\nimport { Controllers } from './Scroller/Controllers';\nexport const ChartContainer = () => {\n const {\n props: { yAxis, xScroll, scrapper, xAxis },\n containerRef,\n activePoint,\n internalMargin,\n setScrapperPosY,\n setScrapperPosX,\n setContainerRef,\n svgRef,\n isGrabbed,\n setIsGrabbed,\n startPosition,\n innerWidth,\n innerHeight,\n setActivePoint,\n setXScrollbarPosition,\n xScrollbarPosition,\n containerRatio,\n lastPosition,\n setIsScrollbarVisible,\n width,\n height,\n currentData,\n } = useContext(ChartContext);\n\n // const xScroll = xAxis.advanced?.pointSpacing?.value > 1;\n const yScroll = yAxis.advanced?.pointSpacing?.value > 1;\n const { onInputKeyDown, handleOnBlur, handleOnFocus } = useKeyboardNavigation();\n\n const onMouseEnterHandler = useCallback(() => {\n setIsScrollbarVisible(true);\n }, [setIsScrollbarVisible]);\n const onMouseLeaveHandler = useCallback(() => {\n setScrapperPosY('');\n setScrapperPosX('');\n setIsScrollbarVisible(false);\n setIsGrabbed(false);\n }, [setIsGrabbed, setIsScrollbarVisible, setScrapperPosX, setScrapperPosY]);\n\n const handleMouseMove: React.MouseEventHandler = useCallback(\n (e) => {\n if (!isGrabbed) return;\n setActivePoint(null);\n if (xScroll) {\n const newPosition = lastPosition?.current + e.clientX - startPosition;\n if (newPosition < 0) setXScrollbarPosition(0);\n else if (newPosition > innerWidth - innerWidth / containerRatio)\n setXScrollbarPosition(innerWidth - innerWidth / containerRatio);\n else setXScrollbarPosition(newPosition);\n }\n if (yScroll) {\n const newPosition = lastPosition?.current + e.clientY - startPosition;\n if (newPosition < 0) setXScrollbarPosition(0);\n else if (newPosition > innerHeight - innerHeight / containerRatio)\n setXScrollbarPosition(innerHeight - innerHeight / containerRatio);\n else setXScrollbarPosition(newPosition);\n }\n },\n [\n isGrabbed,\n setActivePoint,\n xScroll,\n yScroll,\n lastPosition,\n startPosition,\n setXScrollbarPosition,\n innerWidth,\n containerRatio,\n innerHeight,\n ],\n );\n const handleMouseUp = useCallback(() => {\n lastPosition.current = xScrollbarPosition;\n setIsGrabbed(false);\n }, [lastPosition, setIsGrabbed, xScrollbarPosition]);\n\n const key = useMemo(\n () =>\n `translate(${width},${internalMargin.left},${internalMargin.top},${internalMargin.right},${internalMargin.bottom})`,\n [internalMargin, width],\n );\n\n if (currentData.length === 0) return null;\n\n const render = useMemo(() => {\n if (xScroll || xAxis.advanced?.pointSpacing?.value > 1) {\n return (\n <>\n <AxisRight />\n <AxisLeft />\n <ScrollableContainerX />\n </>\n );\n }\n if (yScroll) {\n return (\n <>\n <AxisBottom />\n <ScrollableContainerY />\n </>\n );\n }\n return (\n <>\n <AxisRight />\n <AxisLeft />\n <AxisBottom />\n <SeriesFactory />\n {scrapper?.type === 'horizontal' ? <Scrapper /> : null}\n {scrapper?.type === 'vertical' ? <VerticalScrapper /> : null}\n </>\n );\n }, [scrapper?.type, xAxis.advanced?.pointSpacing?.value, xScroll, yScroll]);\n return (\n <StyledSVGWrapper\n ref={setContainerRef}\n onKeyDown={onInputKeyDown}\n aria-hidden=\"true\"\n tabIndex={activePoint ? -1 : 0}\n onBlur={handleOnBlur}\n onFocus={handleOnFocus}\n onMouseEnter={onMouseEnterHandler}\n onMouseLeave={onMouseLeaveHandler}\n onMouseMove={handleMouseMove}\n onMouseUp={handleMouseUp}\n onMouseDown={(e) => e.preventDefault()}\n isGrabbed={isGrabbed}\n >\n {width !== 0 ? (\n <svg ref={svgRef} width={width} height={height}>\n <ClipPaths />\n <BlurMask />\n <g key={key}>\n <g>\n <Controllers />\n <Legend />\n <Label />\n </g>\n <g className=\"container\" transform={`translate(${internalMargin.left},${internalMargin.top})`}>\n {render}\n {/* <ActivePoint/> @todo */}\n </g>\n </g>\n {/* this clipaths for animations and focus ring.. need to give a deeper look */}\n </svg>\n ) : null}\n </StyledSVGWrapper>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,YAAY,SAAS,mBAA8B;AACnE,SAAS,wBAAwB;AAEjC,SAAS,oBAAoB;AAC7B,SAAS,6BAA6B;AACtC,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;AACrC,SAAS,4BAA4B;AAErC,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB;AACzB,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AACrB,MAAM,iBAAiB,MAAM;AAClC,QAAM;AAAA,IACJ,OAAO,EAAE,OAAO,SAAS,UAAU,MAAM;AAAA,IACzC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,WAAW,YAAY;AAG3B,QAAM,UAAU,MAAM,UAAU,cAAc,QAAQ;AACtD,QAAM,EAAE,gBAAgB,cAAc,cAAc,IAAI,sBAAsB;AAE9E,QAAM,sBAAsB,YAAY,MAAM;AAC5C,0BAAsB,IAAI;AAAA,EAC5B,GAAG,CAAC,qBAAqB,CAAC;AAC1B,QAAM,sBAAsB,YAAY,MAAM;AAC5C,oBAAgB,EAAE;AAClB,oBAAgB,EAAE;AAClB,0BAAsB,KAAK;AAC3B,iBAA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} from "react/jsx-runtime";
|
|
3
3
|
import { useContext } from "react";
|
|
4
4
|
import { ChartContext } from "../ChartContext";
|
|
5
5
|
const ClipPaths = () => {
|
|
@@ -12,45 +12,21 @@ const ClipPaths = () => {
|
|
|
12
12
|
props: { xAxis, yAxis }
|
|
13
13
|
} = useContext(ChartContext);
|
|
14
14
|
const yScroll = yAxis.advanced?.pointSpacing?.value > 1;
|
|
15
|
-
return /* @__PURE__ */
|
|
16
|
-
children:
|
|
17
|
-
/* @__PURE__ */ jsx("
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
y: -4
|
|
28
|
-
})
|
|
15
|
+
return /* @__PURE__ */ jsx(Fragment, {
|
|
16
|
+
children: /* @__PURE__ */ jsx("defs", {
|
|
17
|
+
children: /* @__PURE__ */ jsx("clipPath", {
|
|
18
|
+
id: `rect-focus-ring-${chartId}`,
|
|
19
|
+
children: yScroll ? /* @__PURE__ */ jsx("rect", {
|
|
20
|
+
width: innerWidth + 4,
|
|
21
|
+
height: innerHeight * containerRatio,
|
|
22
|
+
x: -4
|
|
23
|
+
}) : /* @__PURE__ */ jsx("rect", {
|
|
24
|
+
width: innerWidth * containerRatio,
|
|
25
|
+
height: innerHeight + 4,
|
|
26
|
+
y: -4
|
|
29
27
|
})
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
children: /* @__PURE__ */ jsx("clipPath", {
|
|
33
|
-
id: `rects-positive-${chartId}`,
|
|
34
|
-
children: /* @__PURE__ */ jsx("rect", {
|
|
35
|
-
width: innerWidth * containerRatio,
|
|
36
|
-
height: yScale(0) + 8,
|
|
37
|
-
y: -8,
|
|
38
|
-
x: -10
|
|
39
|
-
})
|
|
40
|
-
})
|
|
41
|
-
}),
|
|
42
|
-
innerHeight - yScale(0) > 0 ? /* @__PURE__ */ jsx("defs", {
|
|
43
|
-
children: /* @__PURE__ */ jsx("clipPath", {
|
|
44
|
-
id: `rects-negative-${chartId}`,
|
|
45
|
-
children: /* @__PURE__ */ jsx("rect", {
|
|
46
|
-
width: innerWidth * containerRatio,
|
|
47
|
-
height: innerHeight - yScale(0),
|
|
48
|
-
x: -10,
|
|
49
|
-
y: yScale(0)
|
|
50
|
-
})
|
|
51
|
-
})
|
|
52
|
-
}) : null
|
|
53
|
-
]
|
|
28
|
+
})
|
|
29
|
+
})
|
|
54
30
|
});
|
|
55
31
|
};
|
|
56
32
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/graphs/Chart/parts/ClipPaths.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable arrow-body-style */\n/* eslint-disable indent */\nimport React, { useContext } from 'react';\nimport { ChartContext } from '../ChartContext';\n\nexport const ClipPaths = () => {\n const {\n innerWidth,\n containerRatio,\n innerHeight,\n chartId,\n yScale,\n props: { xAxis, yAxis },\n } = useContext(ChartContext);\n\n const yScroll = yAxis.advanced?.pointSpacing?.value > 1;\n\n return (\n <>\n <defs>\n <clipPath id={`rect-focus-ring-${chartId}`}>\n {yScroll ? (\n <rect width={innerWidth + 4} height={innerHeight * containerRatio} x={-4} />\n ) : (\n <rect width={innerWidth * containerRatio} height={innerHeight + 4} y={-4} />\n )}\n </clipPath>\n </defs>\n <defs>\n <clipPath id={`rects-positive-${chartId}`}>\n <rect width={innerWidth * containerRatio} height={yScale(0) + 8} y={-8} x={-10} />\n </clipPath>\n </defs>\n {innerHeight - yScale(0) > 0 ? (\n <defs>\n <clipPath id={`rects-negative-${chartId}`}>\n <rect width={innerWidth * containerRatio} height={innerHeight - yScale(0)} x={-10} y={yScale(0)} />\n </clipPath>\n </defs>\n ) : null}\n </>\n );\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAEA,SAAgB,kBAAkB;AAClC,SAAS,oBAAoB;AAEtB,MAAM,YAAY,MAAM;AAC7B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,OAAO,MAAM;AAAA,EACxB,IAAI,WAAW,YAAY;AAE3B,QAAM,UAAU,MAAM,UAAU,cAAc,QAAQ;AAEtD,SACE;AAAA,IACE
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable arrow-body-style */\n/* eslint-disable indent */\nimport React, { useContext } from 'react';\nimport { ChartContext } from '../ChartContext';\n\nexport const ClipPaths = () => {\n const {\n innerWidth,\n containerRatio,\n innerHeight,\n chartId,\n yScale,\n props: { xAxis, yAxis },\n } = useContext(ChartContext);\n\n const yScroll = yAxis.advanced?.pointSpacing?.value > 1;\n\n return (\n <>\n <defs>\n <clipPath id={`rect-focus-ring-${chartId}`}>\n {yScroll ? (\n <rect width={innerWidth + 4} height={innerHeight * containerRatio} x={-4} />\n ) : (\n <rect width={innerWidth * containerRatio} height={innerHeight + 4} y={-4} />\n )}\n </clipPath>\n </defs>\n {/* \n this can be useful when implementing animations\n <defs>\n <clipPath id={`rects-positive-${chartId}`}>\n <rect width={innerWidth * containerRatio} height={yScale(0) + 8} y={-8} x={-10} />\n </clipPath>\n </defs>\n {innerHeight - yScale(0) > 0 ? (\n <defs>\n <clipPath id={`rects-negative-${chartId}`}>\n <rect width={innerWidth * containerRatio} height={innerHeight - yScale(0)} x={-10} y={yScale(0)} />\n </clipPath>\n </defs>\n ) : null} */}\n </>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAEA,SAAgB,kBAAkB;AAClC,SAAS,oBAAoB;AAEtB,MAAM,YAAY,MAAM;AAC7B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,OAAO,MAAM;AAAA,EACxB,IAAI,WAAW,YAAY;AAE3B,QAAM,UAAU,MAAM,UAAU,cAAc,QAAQ;AAEtD,SACE;AAAA,IACE,8BAAC;AAAA,MACC,8BAAC;AAAA,QAAS,IAAI,mBAAmB;AAAA,QAC9B,oBACC,oBAAC;AAAA,UAAK,OAAO,aAAa;AAAA,UAAG,QAAQ,cAAc;AAAA,UAAgB,GAAG;AAAA,SAAI,IAE1E,oBAAC;AAAA,UAAK,OAAO,aAAa;AAAA,UAAgB,QAAQ,cAAc;AAAA,UAAG,GAAG;AAAA,SAAI;AAAA,OAE9E;AAAA,KACF;AAAA,GAeF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -8,14 +8,15 @@ import { BottomLegend } from "./BottomLegend";
|
|
|
8
8
|
import { LeftLegend } from "./LeftLegend";
|
|
9
9
|
const Legend = () => {
|
|
10
10
|
const {
|
|
11
|
-
props: { legend }
|
|
11
|
+
props: { legend },
|
|
12
|
+
width
|
|
12
13
|
} = useContext(ChartContext);
|
|
13
|
-
if (legend?.position === "
|
|
14
|
-
return /* @__PURE__ */ jsx(RightLegend, {});
|
|
15
|
-
if (legend?.position === "top")
|
|
14
|
+
if (legend?.position === "top" || legend?.position === "left" && width <= 400)
|
|
16
15
|
return /* @__PURE__ */ jsx(TopLegend, {});
|
|
17
|
-
if (legend?.position === "bottom")
|
|
16
|
+
if (legend?.position === "bottom" || legend?.position === "right" && width <= 400)
|
|
18
17
|
return /* @__PURE__ */ jsx(BottomLegend, {});
|
|
18
|
+
if (legend?.position === "right")
|
|
19
|
+
return /* @__PURE__ */ jsx(RightLegend, {});
|
|
19
20
|
if (legend?.position === "left")
|
|
20
21
|
return /* @__PURE__ */ jsx(LeftLegend, {});
|
|
21
22
|
return null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../../src/graphs/Chart/parts/Legend/Legend.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { RightLegend } from './RightLegend';\nimport { TopLegend } from './TopLegend';\nimport { ChartContext } from '../../ChartContext';\nimport { BottomLegend } from './BottomLegend';\nimport { LeftLegend } from './LeftLegend';\nexport const Legend = () => {\n const {\n props: { legend },\n } = useContext(ChartContext);\n
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,kBAAkB;AAClC,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AACpB,MAAM,SAAS,MAAM;AAC1B,QAAM;AAAA,IACJ,OAAO,EAAE,OAAO;AAAA,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { RightLegend } from './RightLegend';\nimport { TopLegend } from './TopLegend';\nimport { ChartContext } from '../../ChartContext';\nimport { BottomLegend } from './BottomLegend';\nimport { LeftLegend } from './LeftLegend';\nexport const Legend = () => {\n const {\n props: { legend },\n width,\n } = useContext(ChartContext);\n if (legend?.position === 'top' || (legend?.position === 'left' && width <= 400)) return <TopLegend />;\n if (legend?.position === 'bottom' || (legend?.position === 'right' && width <= 400)) return <BottomLegend />;\n if (legend?.position === 'right') return <RightLegend />;\n if (legend?.position === 'left') return <LeftLegend />;\n return null;\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,kBAAkB;AAClC,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AACpB,MAAM,SAAS,MAAM;AAC1B,QAAM;AAAA,IACJ,OAAO,EAAE,OAAO;AAAA,IAChB;AAAA,EACF,IAAI,WAAW,YAAY;AAC3B,MAAI,QAAQ,aAAa,SAAU,QAAQ,aAAa,UAAU,SAAS;AAAM,WAAO,oBAAC,aAAU;AACnG,MAAI,QAAQ,aAAa,YAAa,QAAQ,aAAa,WAAW,SAAS;AAAM,WAAO,oBAAC,gBAAa;AAC1G,MAAI,QAAQ,aAAa;AAAS,WAAO,oBAAC,eAAY;AACtD,MAAI,QAAQ,aAAa;AAAQ,WAAO,oBAAC,cAAW;AACpD,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,7 +5,7 @@ import { selectAll, select } from "d3";
|
|
|
5
5
|
import { ChartContext } from "../../ChartContext";
|
|
6
6
|
import { LegendItem } from "./LegendItem";
|
|
7
7
|
const TopLegend = () => {
|
|
8
|
-
const { colorScale, internalMargin, innerWidth, setTopLegend } = useContext(ChartContext);
|
|
8
|
+
const { colorScale, internalMargin, innerWidth, setTopLegend, toolbarHeight } = useContext(ChartContext);
|
|
9
9
|
const ref = useRef(null);
|
|
10
10
|
const firstRender = useRef(true);
|
|
11
11
|
const [xTransform, setXTransform] = useState(innerWidth / 2 + internalMargin.left);
|
|
@@ -31,7 +31,7 @@ const TopLegend = () => {
|
|
|
31
31
|
const render = useMemo(
|
|
32
32
|
() => /* @__PURE__ */ jsx("g", {
|
|
33
33
|
ref,
|
|
34
|
-
transform: `translate(${xTransform}
|
|
34
|
+
transform: `translate(${xTransform},${toolbarHeight + 30})`,
|
|
35
35
|
children: /* @__PURE__ */ jsxs("g", {
|
|
36
36
|
ref: setTopLegend,
|
|
37
37
|
children: [
|
|
@@ -46,7 +46,7 @@ const TopLegend = () => {
|
|
|
46
46
|
]
|
|
47
47
|
})
|
|
48
48
|
}),
|
|
49
|
-
[colorScale, setTopLegend, xTransform]
|
|
49
|
+
[colorScale, setTopLegend, xTransform, toolbarHeight]
|
|
50
50
|
);
|
|
51
51
|
return render;
|
|
52
52
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../../src/graphs/Chart/parts/Legend/TopLegend.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo, useLayoutEffect, useRef, useState } from 'react';\n\nimport { selectAll, select } from 'd3';\nimport { ChartContext } from '../../ChartContext';\nimport { LegendItem } from './LegendItem';\n\nexport const TopLegend = () => {\n const { colorScale, internalMargin, innerWidth, setTopLegend } = useContext(ChartContext);\n\n const ref = useRef(null);\n const firstRender = useRef(true);\n\n const [xTransform, setXTransform] = useState(innerWidth / 2 + internalMargin.left);\n\n useLayoutEffect(() => {\n if (ref.current && firstRender.current) {\n const cells = selectAll('.cell');\n const padding = 40;\n let offset = 0;\n cells.each((d, i) => {\n if (cells._groups[0][i - 1]) {\n const lastCell = select(cells._groups[0][i - 1]);\n const d3sel = select(cells._groups[0][i]);\n\n const { width } = lastCell.node().getBBox();\n offset += width + padding;\n d3sel.attr('transform', `translate(${offset}, 0)`);\n }\n });\n const bounds = ref.current.getBoundingClientRect();\n setXTransform((prev) => prev - bounds.width / 2);\n firstRender.current = false;\n }\n }, []);\n\n const render = useMemo(\n () => (\n <g ref={ref} transform={`translate(${xTransform}
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,YAAY,SAAS,iBAAiB,QAAQ,gBAAgB;AAE9E,SAAS,WAAW,cAAc;AAClC,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAEpB,MAAM,YAAY,MAAM;AAC7B,QAAM,EAAE,YAAY,gBAAgB,YAAY,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo, useLayoutEffect, useRef, useState } from 'react';\n\nimport { selectAll, select } from 'd3';\nimport { ChartContext } from '../../ChartContext';\nimport { LegendItem } from './LegendItem';\n\nexport const TopLegend = () => {\n const { colorScale, internalMargin, innerWidth, setTopLegend, toolbarHeight } = useContext(ChartContext);\n\n const ref = useRef(null);\n const firstRender = useRef(true);\n\n const [xTransform, setXTransform] = useState(innerWidth / 2 + internalMargin.left);\n\n useLayoutEffect(() => {\n if (ref.current && firstRender.current) {\n const cells = selectAll('.cell');\n const padding = 40;\n let offset = 0;\n cells.each((d, i) => {\n if (cells._groups[0][i - 1]) {\n const lastCell = select(cells._groups[0][i - 1]);\n const d3sel = select(cells._groups[0][i]);\n\n const { width } = lastCell.node().getBBox();\n offset += width + padding;\n d3sel.attr('transform', `translate(${offset}, 0)`);\n }\n });\n const bounds = ref.current.getBoundingClientRect();\n setXTransform((prev) => prev - bounds.width / 2);\n firstRender.current = false;\n }\n }, []);\n\n const render = useMemo(\n () => (\n <g ref={ref} transform={`translate(${xTransform},${toolbarHeight + 30})`}>\n <g ref={setTopLegend}>\n <rect height={40} width={1} fill=\"transparent\" />\n {colorScale.domain().map((domainValue, i) => (\n <LegendItem key={domainValue} domainValue={domainValue} />\n ))}\n </g>\n </g>\n ),\n\n [colorScale, setTopLegend, xTransform, toolbarHeight],\n );\n\n return render;\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,YAAY,SAAS,iBAAiB,QAAQ,gBAAgB;AAE9E,SAAS,WAAW,cAAc;AAClC,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAEpB,MAAM,YAAY,MAAM;AAC7B,QAAM,EAAE,YAAY,gBAAgB,YAAY,cAAc,cAAc,IAAI,WAAW,YAAY;AAEvG,QAAM,MAAM,OAAO,IAAI;AACvB,QAAM,cAAc,OAAO,IAAI;AAE/B,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,aAAa,IAAI,eAAe,IAAI;AAEjF,kBAAgB,MAAM;AACpB,QAAI,IAAI,WAAW,YAAY,SAAS;AACtC,YAAM,QAAQ,UAAU,OAAO;AAC/B,YAAM,UAAU;AAChB,UAAI,SAAS;AACb,YAAM,KAAK,CAAC,GAAG,MAAM;AACnB,YAAI,MAAM,QAAQ,GAAG,IAAI,IAAI;AAC3B,gBAAM,WAAW,OAAO,MAAM,QAAQ,GAAG,IAAI,EAAE;AAC/C,gBAAM,QAAQ,OAAO,MAAM,QAAQ,GAAG,EAAE;AAExC,gBAAM,EAAE,MAAM,IAAI,SAAS,KAAK,EAAE,QAAQ;AAC1C,oBAAU,QAAQ;AAClB,gBAAM,KAAK,aAAa,aAAa,YAAY;AAAA,QACnD;AAAA,MACF,CAAC;AACD,YAAM,SAAS,IAAI,QAAQ,sBAAsB;AACjD,oBAAc,CAAC,SAAS,OAAO,OAAO,QAAQ,CAAC;AAC/C,kBAAY,UAAU;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,QAAM,SAAS;AAAA,IACb,MACE,oBAAC;AAAA,MAAE;AAAA,MAAU,WAAW,aAAa,cAAc,gBAAgB;AAAA,MACjE,+BAAC;AAAA,QAAE,KAAK;AAAA,QACN;AAAA,8BAAC;AAAA,YAAK,QAAQ;AAAA,YAAI,OAAO;AAAA,YAAG,MAAK;AAAA,WAAc;AAAA,UAC9C,WAAW,OAAO,EAAE,IAAI,CAAC,aAAa,MACrC,oBAAC;AAAA,YAA6B;AAAA,aAAb,WAAuC,CACzD;AAAA;AAAA,OACH;AAAA,KACF;AAAA,IAGF,CAAC,YAAY,cAAc,YAAY,aAAa;AAAA,EACtD;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,7 +5,7 @@ import { VerticalScrapperLine } from "./VerticalScrapperLine";
|
|
|
5
5
|
import { useUniqueData } from "../../helpers/useUniqueData";
|
|
6
6
|
const VerticalScrapper = () => {
|
|
7
7
|
const uniqueData = useUniqueData();
|
|
8
|
-
|
|
8
|
+
return useMemo(
|
|
9
9
|
() => /* @__PURE__ */ jsx("g", {
|
|
10
10
|
className: "vertical-scrapper",
|
|
11
11
|
children: uniqueData.map((line) => /* @__PURE__ */ jsx(VerticalScrapperLine, {
|
|
@@ -16,7 +16,6 @@ const VerticalScrapper = () => {
|
|
|
16
16
|
}),
|
|
17
17
|
[uniqueData]
|
|
18
18
|
);
|
|
19
|
-
return render;
|
|
20
19
|
};
|
|
21
20
|
export {
|
|
22
21
|
VerticalScrapper
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../../src/graphs/Chart/parts/Scrapper/VerticalScrapper.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo } from 'react';\nimport { VerticalScrapperLine } from './VerticalScrapperLine';\nimport { useUniqueData } from '../../helpers/useUniqueData';\nexport const VerticalScrapper = () => {\n const uniqueData = useUniqueData();\n
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,eAAe;AAC/B,SAAS,4BAA4B;AACrC,SAAS,qBAAqB;AACvB,MAAM,mBAAmB,MAAM;AACpC,QAAM,aAAa,cAAc;AACjC,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo } from 'react';\nimport { VerticalScrapperLine } from './VerticalScrapperLine';\nimport { useUniqueData } from '../../helpers/useUniqueData';\nexport const VerticalScrapper = () => {\n const uniqueData = useUniqueData();\n return useMemo(\n () => (\n <g className=\"vertical-scrapper\">\n {uniqueData.map((line) => (\n <VerticalScrapperLine\n rectDetector={line?.rectDetector}\n xPosition={line.xPosition}\n key={line.xPosition}\n datum={line.datum}\n />\n ))}\n </g>\n ),\n\n [uniqueData],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,eAAe;AAC/B,SAAS,4BAA4B;AACrC,SAAS,qBAAqB;AACvB,MAAM,mBAAmB,MAAM;AACpC,QAAM,aAAa,cAAc;AACjC,SAAO;AAAA,IACL,MACE,oBAAC;AAAA,MAAE,WAAU;AAAA,MACV,qBAAW,IAAI,CAAC,SACf,oBAAC;AAAA,QACC,cAAc,MAAM;AAAA,QACpB,WAAW,KAAK;AAAA,QAEhB,OAAO,KAAK;AAAA,SADP,KAAK,SAEZ,CACD;AAAA,KACH;AAAA,IAGF,CAAC,UAAU;AAAA,EACb;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -11,6 +11,7 @@ const VerticalScrapperLine = React2.memo(({ rectDetector, xPosition, datum }) =>
|
|
|
11
11
|
setScrapperPosX,
|
|
12
12
|
isGrabbed,
|
|
13
13
|
xScale,
|
|
14
|
+
yScale,
|
|
14
15
|
setActivePoint,
|
|
15
16
|
innerHeight,
|
|
16
17
|
props: { TooltipRenderer, scrapper }
|
|
@@ -23,8 +24,9 @@ const VerticalScrapperLine = React2.memo(({ rectDetector, xPosition, datum }) =>
|
|
|
23
24
|
setScrapperPosX(xPosition);
|
|
24
25
|
setActivePoint(null);
|
|
25
26
|
}, [isGrabbed, setActivePoint, setScrapperPosX, xPosition]);
|
|
26
|
-
|
|
27
|
+
return useMemo(
|
|
27
28
|
() => /* @__PURE__ */ jsxs("g", {
|
|
29
|
+
transform: `translate(${xScale.bandwidth ? xScale.bandwidth() / 2 : 0}, 0)`,
|
|
28
30
|
children: [
|
|
29
31
|
isActive && !isGrabbed ? /* @__PURE__ */ jsxs("g", {
|
|
30
32
|
children: [
|
|
@@ -85,7 +87,6 @@ const VerticalScrapperLine = React2.memo(({ rectDetector, xPosition, datum }) =>
|
|
|
85
87
|
rectDetector
|
|
86
88
|
]
|
|
87
89
|
);
|
|
88
|
-
return render;
|
|
89
90
|
});
|
|
90
91
|
export {
|
|
91
92
|
VerticalScrapperLine
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../../src/graphs/Chart/parts/Scrapper/VerticalScrapperLine.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useCallback, useState, useMemo } from 'react';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport { ThemeContext } from '@elliemae/ds-system';\nimport { ChartContext } from '../../ChartContext';\nimport { StyledMouseOverDetectionBox, StyledTooltipContainer } from '../../styles';\n\nexport const VerticalScrapperLine = React.memo(({ rectDetector, xPosition, datum }) => {\n const {\n scrapperPosX,\n setScrapperPosX,\n isGrabbed,\n xScale,\n setActivePoint,\n innerHeight,\n props: { TooltipRenderer, scrapper },\n } = useContext(ChartContext);\n const theme = useContext(ThemeContext);\n const [referenceElement, setReferenceElement] = useState<React.SVGProps<SVGLineElement> | null>();\n const isActive = scrapperPosX === xPosition;\n const handleOnMouseEnter = useCallback(() => {\n if (!isGrabbed) setScrapperPosX(xPosition);\n setActivePoint(null);\n }, [isGrabbed, setActivePoint, setScrapperPosX, xPosition]);\n\n // const strokeDetectorWidth = xScale.bandwidth ? xScale.bandwidth() : lineWidth;\n
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,OAAOA,UAAS,YAAY,aAAa,UAAU,eAAe;AAClE,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,6BAA6B,8BAA8B;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useCallback, useState, useMemo } from 'react';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport { ThemeContext } from '@elliemae/ds-system';\nimport { ChartContext } from '../../ChartContext';\nimport { StyledMouseOverDetectionBox, StyledTooltipContainer } from '../../styles';\nimport { TrendHighlight } from '../TrendHighlight';\n\nexport const VerticalScrapperLine = React.memo(({ rectDetector, xPosition, datum }) => {\n const {\n scrapperPosX,\n setScrapperPosX,\n isGrabbed,\n xScale,\n yScale,\n setActivePoint,\n innerHeight,\n props: { TooltipRenderer, scrapper },\n } = useContext(ChartContext);\n const theme = useContext(ThemeContext);\n const [referenceElement, setReferenceElement] = useState<React.SVGProps<SVGLineElement> | null>();\n const isActive = scrapperPosX === xPosition;\n const handleOnMouseEnter = useCallback(() => {\n if (!isGrabbed) setScrapperPosX(xPosition);\n setActivePoint(null);\n }, [isGrabbed, setActivePoint, setScrapperPosX, xPosition]);\n\n // const strokeDetectorWidth = xScale.bandwidth ? xScale.bandwidth() : lineWidth;\n return useMemo(\n () => (\n <g transform={`translate(${xScale.bandwidth ? xScale.bandwidth() / 2 : 0}, 0)`}>\n {isActive && !isGrabbed ? (\n <g>\n {TooltipRenderer ? (\n <foreignObject>\n <DSPopperJS\n withoutAnimation\n withoutArrow\n customOffset={[0, 5]}\n referenceElement={referenceElement}\n showPopover\n zIndex={theme.zIndex.tooltip}\n startPlacementPreference={scrapper.tooltipPreference}\n >\n <StyledMouseOverDetectionBox />\n <StyledTooltipContainer>\n <TooltipRenderer data={datum} />\n </StyledTooltipContainer>\n </DSPopperJS>\n </foreignObject>\n ) : null}\n <line\n ref={setReferenceElement}\n x1={xPosition}\n strokeWidth=\"2px\"\n stroke={scrapper.color}\n y1={0}\n x2={xPosition}\n y2={innerHeight}\n strokeDasharray={(4, 4)}\n />\n </g>\n ) : null}\n <rect\n onMouseOver={handleOnMouseEnter}\n x={xScale.bandwidth ? xPosition - xScale.bandwidth() / 2 : xPosition - rectDetector?.left}\n fill=\"transparent\"\n y={0}\n width={xScale.bandwidth?.() ?? rectDetector?.right + rectDetector?.left}\n height={innerHeight}\n />\n </g>\n ),\n [\n isActive,\n isGrabbed,\n TooltipRenderer,\n referenceElement,\n theme.zIndex.tooltip,\n scrapper.tooltipPreference,\n scrapper.color,\n datum,\n xPosition,\n innerHeight,\n handleOnMouseEnter,\n xScale,\n rectDetector,\n ],\n );\n});\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,OAAOA,UAAS,YAAY,aAAa,UAAU,eAAe;AAClE,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,6BAA6B,8BAA8B;AAG7D,MAAM,uBAAuBA,OAAM,K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AAO,YAAY,YAAY,OAAO,UAAU,IAAI,IAAI,YAAY,cAAc;AAAA,UACrF,MAAK;AAAA,UACL,GAAG;AAAA,UACH,OAAO,OAAO,YAAY,KAAK,cAAc,QAAQ,cAAc;AAAA,UACnE,QAAQ;AAAA,SACV;AAAA;AAAA,KACF;AAAA,IAEF;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,MAAM,OAAO;AAAA,MACb,SAAS;AAAA,MACT,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF,CAAC;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -4,12 +4,18 @@ import { useContext, useMemo } from "react";
|
|
|
4
4
|
import { ChartContext } from "../../ChartContext";
|
|
5
5
|
const BlurMask = () => {
|
|
6
6
|
const {
|
|
7
|
+
props: { yAxis, xScroll, xAxis },
|
|
7
8
|
xScrollbarPosition,
|
|
8
9
|
innerWidth,
|
|
10
|
+
internalMargin,
|
|
9
11
|
containerRatio,
|
|
12
|
+
innerHeight,
|
|
10
13
|
chartId,
|
|
11
|
-
|
|
14
|
+
height,
|
|
15
|
+
width
|
|
12
16
|
} = useContext(ChartContext);
|
|
17
|
+
const yScrolled = yAxis.advanced?.pointSpacing?.value > 1;
|
|
18
|
+
const xScrolled = xScroll || xAxis.advanced?.pointSpacing?.value > 1;
|
|
13
19
|
const gradient = useMemo(() => {
|
|
14
20
|
if (xScrollbarPosition === 0) {
|
|
15
21
|
return /* @__PURE__ */ jsxs(Fragment, {
|
|
@@ -25,7 +31,9 @@ const BlurMask = () => {
|
|
|
25
31
|
]
|
|
26
32
|
});
|
|
27
33
|
}
|
|
28
|
-
|
|
34
|
+
const isAtEndXScroll = innerWidth * containerRatio === (xScrollbarPosition + innerWidth / containerRatio) * containerRatio;
|
|
35
|
+
const isAtEndYScroll = innerHeight * containerRatio === (xScrollbarPosition + innerHeight / containerRatio) * containerRatio;
|
|
36
|
+
if (isAtEndXScroll || isAtEndYScroll) {
|
|
29
37
|
return /* @__PURE__ */ jsxs(Fragment, {
|
|
30
38
|
children: [
|
|
31
39
|
/* @__PURE__ */ jsx("stop", {
|
|
@@ -59,16 +67,29 @@ const BlurMask = () => {
|
|
|
59
67
|
})
|
|
60
68
|
]
|
|
61
69
|
});
|
|
62
|
-
}, [containerRatio, innerWidth, xScrollbarPosition]);
|
|
70
|
+
}, [containerRatio, innerHeight, innerWidth, xScrollbarPosition]);
|
|
63
71
|
if (containerRatio === 1)
|
|
64
72
|
return null;
|
|
65
73
|
return /* @__PURE__ */ jsxs("defs", {
|
|
66
74
|
children: [
|
|
67
|
-
/* @__PURE__ */ jsx("linearGradient", {
|
|
75
|
+
yScrolled ? /* @__PURE__ */ jsx("linearGradient", {
|
|
76
|
+
x2: "0%",
|
|
77
|
+
y2: "100%",
|
|
78
|
+
id: `filter-fade-${chartId}`,
|
|
79
|
+
children: gradient
|
|
80
|
+
}) : /* @__PURE__ */ jsx("linearGradient", {
|
|
68
81
|
id: `filter-fade-${chartId}`,
|
|
69
82
|
children: gradient
|
|
70
83
|
}),
|
|
71
|
-
/* @__PURE__ */ jsx("mask", {
|
|
84
|
+
yScrolled ? /* @__PURE__ */ jsx("mask", {
|
|
85
|
+
id: `mask-y-${chartId}`,
|
|
86
|
+
children: /* @__PURE__ */ jsx("rect", {
|
|
87
|
+
x: -internalMargin.left,
|
|
88
|
+
width,
|
|
89
|
+
height: innerHeight,
|
|
90
|
+
fill: `url(#filter-fade-${chartId}`
|
|
91
|
+
})
|
|
92
|
+
}) : /* @__PURE__ */ jsx("mask", {
|
|
72
93
|
id: `mask-${chartId}`,
|
|
73
94
|
children: /* @__PURE__ */ jsx("rect", {
|
|
74
95
|
x: 0,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../../src/graphs/Chart/parts/Scroller/BlurMask.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable arrow-body-style */\n/* eslint-disable indent */\nimport React, { useContext, useMemo } from 'react';\nimport { ChartContext } from '../../ChartContext';\n\nexport const BlurMask = () => {\n const {\n xScrollbarPosition,\n innerWidth,\n containerRatio,\n chartId,\n
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAEA,SAAgB,YAAY,eAAe;AAC3C,SAAS,oBAAoB;AAEtB,MAAM,WAAW,MAAM;AAC5B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable arrow-body-style */\n/* eslint-disable indent */\nimport React, { useContext, useMemo } from 'react';\nimport { ChartContext } from '../../ChartContext';\n\nexport const BlurMask = () => {\n const {\n props: { yAxis, xScroll, xAxis },\n xScrollbarPosition,\n innerWidth,\n internalMargin,\n containerRatio,\n innerHeight,\n chartId,\n height,\n width,\n } = useContext(ChartContext);\n\n const yScrolled = yAxis.advanced?.pointSpacing?.value > 1;\n const xScrolled = xScroll || xAxis.advanced?.pointSpacing?.value > 1;\n const gradient = useMemo(() => {\n if (xScrollbarPosition === 0) {\n return (\n <>\n <stop offset=\"93%\" style={{ stopColor: 'white', stopOpacity: 1 }} />\n <stop offset=\"100%\" style={{ stopColor: 'white', stopOpacity: 0 }} />\n </>\n );\n }\n\n const isAtEndXScroll =\n innerWidth * containerRatio === (xScrollbarPosition + innerWidth / containerRatio) * containerRatio;\n const isAtEndYScroll =\n innerHeight * containerRatio === (xScrollbarPosition + innerHeight / containerRatio) * containerRatio;\n if (isAtEndXScroll || isAtEndYScroll) {\n return (\n <>\n <stop offset=\"0%\" style={{ stopColor: 'white', stopOpacity: 0 }} />\n <stop offset=\"7%\" style={{ stopColor: 'white', stopOpacity: 1 }} />\n </>\n );\n }\n\n return (\n <>\n <stop offset=\"0%\" style={{ stopColor: 'white', stopOpacity: 0 }} />\n <stop offset=\"7%\" style={{ stopColor: 'white', stopOpacity: 1 }} />\n <stop offset=\"93%\" style={{ stopColor: 'white', stopOpacity: 1 }} />\n <stop offset=\"100%\" style={{ stopColor: 'white', stopOpacity: 0 }} />\n </>\n );\n }, [containerRatio, innerHeight, innerWidth, xScrollbarPosition]);\n\n if (containerRatio === 1) return null;\n return (\n <defs>\n {yScrolled ? (\n <linearGradient x2=\"0%\" y2=\"100%\" id={`filter-fade-${chartId}`}>\n {gradient}\n </linearGradient>\n ) : (\n <linearGradient id={`filter-fade-${chartId}`}>{gradient}</linearGradient>\n )}\n\n {yScrolled ? (\n <mask id={`mask-y-${chartId}`}>\n <rect x={-internalMargin.left} width={width} height={innerHeight} fill={`url(#filter-fade-${chartId}`}></rect>\n </mask>\n ) : (\n <mask id={`mask-${chartId}`}>\n <rect x={0} width={innerWidth} height={height} fill={`url(#filter-fade-${chartId}`}></rect>\n </mask>\n )}\n </defs>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAEA,SAAgB,YAAY,eAAe;AAC3C,SAAS,oBAAoB;AAEtB,MAAM,WAAW,MAAM;AAC5B,QAAM;AAAA,IACJ,OAAO,EAAE,OAAO,SAAS,MAAM;AAAA,IAC/B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,WAAW,YAAY;AAE3B,QAAM,YAAY,MAAM,UAAU,cAAc,QAAQ;AACxD,QAAM,YAAY,WAAW,MAAM,UAAU,cAAc,QAAQ;AACnE,QAAM,WAAW,QAAQ,MAAM;AAC7B,QAAI,uBAAuB,GAAG;AAC5B,aACE;AAAA,QACE;AAAA,8BAAC;AAAA,YAAK,QAAO;AAAA,YAAM,OAAO,EAAE,WAAW,SAAS,aAAa,EAAE;AAAA,WAAG;AAAA,UAClE,oBAAC;AAAA,YAA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