@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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/graphs/Chart/Chart.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { ChartContainer } from './parts/ChartContainer';\nimport { ChartContext } from './ChartContext';\nimport { useChart } from './config/useChart';\nimport type { DSChartT } from './react-desc-prop-types';\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AACA,4BAA+B;AAC/B,0BAA6B;AAC7B,sBAAyB;
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { ChartContainer } from './parts/ChartContainer';\nimport { ChartContext } from './ChartContext';\nimport { useChart } from './config/useChart';\nimport type { DSChartT } from './react-desc-prop-types';\nexport const Chart: React.ComponentType<DSChartT.Props> = (props) => {\n const ctx = useChart(props);\n return (\n <ChartContext.Provider value={ctx}>\n <ChartContainer />\n </ChartContext.Provider>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AACA,4BAA+B;AAC/B,0BAA6B;AAC7B,sBAAyB;AAElB,MAAM,QAA6C,CAAC,UAAU;AACnE,QAAM,UAAM,0BAAS,KAAK;AAC1B,SACE,4CAAC,iCAAa,UAAb;AAAA,IAAsB,OAAO;AAAA,IAC5B,sDAAC,wCAAe;AAAA,GAClB;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/graphs/Chart/ChartContext.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { createContext, createRef } from 'react';\nimport { ScaleLinear, ScaleBand, scaleLinear, scaleBand, scaleOrdinal, ScaleOrdinal } from 'd3';\nimport { defaultProps, DSChartT } from './react-desc-prop-types';\ninterface ContextT {\n props: DSChartT.Props;\n currentData: DSChartT.InternalData;\n xScale: ScaleLinear<number, number, never> | ScaleBand<string>;\n yScale: ScaleLinear<number, number, never> | ScaleBand<string>;\n y2Scale: ScaleLinear<number, number, never>;\n innerHeight: number;\n innerWidth: number;\n activePoint: DSChartT.InternalDatum | null;\n containerRef: React.RefObject<HTMLDivElement>;\n groups: string[];\n subGroupScale?: ScaleBand<string> | null;\n colorScale: ScaleOrdinal<string, unknown, string>;\n axisLeftRef: SVGGElement | null;\n scrapperPosY: string;\n scrapperPosX: string;\n xScrollbarPosition: number;\n isGrabbed: boolean;\n startPosition: number;\n isScrollbarVisible: boolean;\n
|
|
4
|
+
"sourcesContent": ["import { createContext, createRef } from 'react';\nimport { ScaleLinear, ScaleBand, scaleLinear, scaleBand, scaleOrdinal, ScaleOrdinal } from 'd3';\nimport { defaultProps, DSChartT } from './react-desc-prop-types';\ninterface ContextT {\n props: DSChartT.Props;\n currentData: DSChartT.InternalData;\n xScale: ScaleLinear<number, number, never> | ScaleBand<string>;\n yScale: ScaleLinear<number, number, never> | ScaleBand<string>;\n y2Scale: ScaleLinear<number, number, never>;\n innerHeight: number;\n innerWidth: number;\n activePoint: DSChartT.InternalDatum | null;\n containerRef: React.RefObject<HTMLDivElement>;\n groups: string[];\n subGroupScale?: ScaleBand<string> | null;\n colorScale: ScaleOrdinal<string, unknown, string>;\n axisLeftRef: SVGGElement | null;\n scrapperPosY: string;\n scrapperPosX: string;\n xScrollbarPosition: number;\n isGrabbed: boolean;\n startPosition: number;\n isScrollbarVisible: boolean;\n lastPosition: React.MutableRefObject<number>;\n containerRatio: number;\n internalMargin: {\n bottom: number;\n top: number;\n right: number;\n left: number;\n };\n leftLegendWidth: number;\n leftLegend: SVGGElement;\n rightLegend: SVGGElement;\n axisBottomHeight: number;\n bottomLabelHeight: number;\n rightLabelWidth: number;\n axisRightWidth: number;\n isHorizontal: boolean;\n leftLabel: SVGGElement;\n chartId: string;\n hiddenSeries: string[];\n stackedData: DSChartT.StackedSeriesByGroupT;\n setActivePoint: React.Dispatch<React.SetStateAction<DSChartT.InternalDatum | null>>;\n setLeftAxisRef: React.Dispatch<React.SetStateAction<SVGGElement | null>>;\n getBandwidth: () => number;\n setScrapperPosY: React.Dispatch<React.SetStateAction<string>>;\n setScrapperPosX: React.Dispatch<React.SetStateAction<string>>;\n setXScrollbarPosition: React.Dispatch<React.SetStateAction<number>>;\n setIsGrabbed: React.Dispatch<React.SetStateAction<boolean>>;\n setStartPosition: React.Dispatch<React.SetStateAction<number>>;\n setIsScrollbarVisible: React.Dispatch<React.SetStateAction<boolean>>;\n setAxisLeftRef: React.Dispatch<React.SetStateAction<SVGGElement | null>>;\n setLeftLegend: React.Dispatch<React.SetStateAction<SVGGElement | null>>;\n setRightLegend: React.Dispatch<React.SetStateAction<SVGGElement | null>>;\n setTopLegend: React.Dispatch<React.SetStateAction<SVGGElement | null>>;\n setBottomLegend: React.Dispatch<React.SetStateAction<SVGGElement | null>>;\n setAxisBottomRef: React.Dispatch<React.SetStateAction<SVGGElement | null>>;\n setLeftLabel: React.Dispatch<React.SetStateAction<SVGGElement | null>>;\n setAxisRightRef: React.Dispatch<React.SetStateAction<SVGGElement | null>>;\n setRightLabel: React.Dispatch<React.SetStateAction<SVGGElement | null>>;\n setBottomLabel: React.Dispatch<React.SetStateAction<SVGGElement | null>>;\n getXValue: (datum: DSChartT.InternalDatum) => string | number | Date;\n getYValue: (datum: DSChartT.InternalDatum) => string | number | Date;\n setHiddenSeries: React.Dispatch<React.SetStateAction<string[]>>;\n getXScaleValue: (datum: DSChartT.InternalDatum) => number | undefined;\n getYScaleValue: (datum: DSChartT.InternalDatum) => number | undefined;\n}\nconst defaultContext: ContextT = {\n props: defaultProps,\n xScale: scaleBand(),\n yScale: scaleLinear(),\n innerHeight: 0,\n innerWidth: 0,\n activePoint: null,\n setActivePoint: () => {},\n scrapperPosY: '',\n setScrapperPosY: () => {},\n containerRef: createRef<HTMLDivElement>(),\n groups: [],\n colorScale: scaleOrdinal(),\n setLeftAxisRef: () => {},\n};\nexport const ChartContext = createContext(defaultContext);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAyC;AACzC,gBAA2F;AAC3F,mCAAuC;AAkEvC,MAAM,iBAA2B;AAAA,EAC/B,OAAO;AAAA,EACP,YAAQ,qBAAU;AAAA,EAClB,YAAQ,uBAAY;AAAA,EACpB,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,gBAAgB,MAAM;AAAA,EAAC;AAAA,EACvB,cAAc;AAAA,EACd,iBAAiB,MAAM;AAAA,EAAC;AAAA,EACxB,kBAAc,wBAA0B;AAAA,EACxC,QAAQ,CAAC;AAAA,EACT,gBAAY,wBAAa;AAAA,EACzB,gBAAgB,MAAM;AAAA,EAAC;AACzB;AACO,MAAM,mBAAe,4BAAc,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var DataTestIds_exports = {};
|
|
26
|
+
__export(DataTestIds_exports, {
|
|
27
|
+
DataVizDataTestIds: () => DataVizDataTestIds
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(DataTestIds_exports);
|
|
30
|
+
var React = __toESM(require("react"));
|
|
31
|
+
const DataVizDataTestIds = {
|
|
32
|
+
POINT: "ds-dataviz-point",
|
|
33
|
+
BAR: "ds-dataviz-bar",
|
|
34
|
+
LINE: "ds-dataviz-line"
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=DataTestIds.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/graphs/Chart/DataTestIds.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export const DataVizDataTestIds = {\n POINT: 'ds-dataviz-point',\n BAR: 'ds-dataviz-bar',\n LINE: 'ds-dataviz-line',\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,qBAAqB;AAAA,EAChC,OAAO;AAAA,EACP,KAAK;AAAA,EACL,MAAM;AACR;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -30,14 +30,42 @@ module.exports = __toCommonJS(useChart_exports);
|
|
|
30
30
|
var React = __toESM(require("react"));
|
|
31
31
|
var import_react = require("react");
|
|
32
32
|
var import_uuid = require("uuid");
|
|
33
|
+
var import_lodash = require("lodash");
|
|
33
34
|
var import_useScales = require("./useScales");
|
|
34
35
|
var import_helpers = require("../helpers");
|
|
35
36
|
var import_useInternalMargins = require("./useInternalMargins");
|
|
36
37
|
var import_useGetters = require("./useGetters");
|
|
38
|
+
const useResizeObserver = (ref) => {
|
|
39
|
+
const [dimensions, setDimensions] = (0, import_react.useState)(null);
|
|
40
|
+
const firstRender = (0, import_react.useRef)(true);
|
|
41
|
+
(0, import_react.useEffect)(() => {
|
|
42
|
+
const observeTarget = ref?.current || ref;
|
|
43
|
+
if (firstRender.current) {
|
|
44
|
+
firstRender.current = false;
|
|
45
|
+
return () => {
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const resizeObserver = new ResizeObserver(
|
|
49
|
+
(0, import_lodash.debounce)((entries) => {
|
|
50
|
+
entries.forEach((entry) => {
|
|
51
|
+
setDimensions(entry.contentRect);
|
|
52
|
+
});
|
|
53
|
+
}, 200)
|
|
54
|
+
);
|
|
55
|
+
resizeObserver.observe(observeTarget);
|
|
56
|
+
return () => {
|
|
57
|
+
resizeObserver.unobserve(observeTarget);
|
|
58
|
+
};
|
|
59
|
+
}, [ref]);
|
|
60
|
+
return dimensions;
|
|
61
|
+
};
|
|
37
62
|
const useChart = (props) => {
|
|
38
|
-
const { series, yAxis, xAxis, width, height, groups: groupsStacked } = props;
|
|
39
|
-
const containerRef = (0, import_react.
|
|
63
|
+
const { series, yAxis, xAxis, width: userWidth, height: userHeight, groups: groupsStacked } = props;
|
|
64
|
+
const [containerRef, setContainerRef] = (0, import_react.useState)(null);
|
|
40
65
|
const svgRef = (0, import_react.useRef)(null);
|
|
66
|
+
const dimensions = useResizeObserver(containerRef?.parentElement);
|
|
67
|
+
const width = (0, import_react.useMemo)(() => userWidth ?? dimensions?.width ?? 0, [dimensions, userWidth]);
|
|
68
|
+
const height = (0, import_react.useMemo)(() => userHeight ?? 500, [userHeight]);
|
|
41
69
|
const [isGrabbed, setIsGrabbed] = (0, import_react.useState)(false);
|
|
42
70
|
const [startPosition, setStartPosition] = (0, import_react.useState)(0);
|
|
43
71
|
const [activePoint, setActivePoint] = (0, import_react.useState)(null);
|
|
@@ -46,7 +74,10 @@ const useChart = (props) => {
|
|
|
46
74
|
const [scrapperPosX, setScrapperPosX] = (0, import_react.useState)("");
|
|
47
75
|
const [xScrollbarPosition, setXScrollbarPosition] = (0, import_react.useState)(0);
|
|
48
76
|
const [isScrollbarVisible, setIsScrollbarVisible] = (0, import_react.useState)(false);
|
|
49
|
-
const
|
|
77
|
+
const [containerRatio, setContainerRatio] = (0, import_react.useState)(
|
|
78
|
+
props?.xAxis.advanced?.pointSpacing?.value ?? props?.yAxis.advanced?.pointSpacing?.value ?? 1
|
|
79
|
+
);
|
|
80
|
+
const lastPosition = (0, import_react.useRef)(0);
|
|
50
81
|
const [axisLeftRef, setAxisLeftRef] = (0, import_react.useState)(null);
|
|
51
82
|
const [axisBottomRef, setAxisBottomRef] = (0, import_react.useState)(null);
|
|
52
83
|
const [axisRightRef, setAxisRightRef] = (0, import_react.useState)(null);
|
|
@@ -57,7 +88,16 @@ const useChart = (props) => {
|
|
|
57
88
|
const [rightLabel, setRightLabel] = (0, import_react.useState)(null);
|
|
58
89
|
const [leftLabel, setLeftLabel] = (0, import_react.useState)(null);
|
|
59
90
|
const [bottomLabel, setBottomLabel] = (0, import_react.useState)(null);
|
|
60
|
-
const
|
|
91
|
+
const [toolbarRef, setToolbarRef] = (0, import_react.useState)(null);
|
|
92
|
+
const {
|
|
93
|
+
toolbarHeight,
|
|
94
|
+
axisBottomHeight,
|
|
95
|
+
axisRightWidth,
|
|
96
|
+
bottomLabelHeight,
|
|
97
|
+
internalMargin,
|
|
98
|
+
leftLegendWidth,
|
|
99
|
+
rightLabelWidth
|
|
100
|
+
} = (0, import_useInternalMargins.useInternalMargins)({
|
|
61
101
|
axisLeftRef,
|
|
62
102
|
axisBottomRef,
|
|
63
103
|
axisRightRef,
|
|
@@ -67,7 +107,8 @@ const useChart = (props) => {
|
|
|
67
107
|
topLegend,
|
|
68
108
|
bottomLegend,
|
|
69
109
|
rightLabel,
|
|
70
|
-
bottomLabel
|
|
110
|
+
bottomLabel,
|
|
111
|
+
toolbarRef
|
|
71
112
|
});
|
|
72
113
|
const innerWidth = (0, import_react.useMemo)(
|
|
73
114
|
() => width - internalMargin.left - internalMargin.right,
|
|
@@ -86,13 +127,13 @@ const useChart = (props) => {
|
|
|
86
127
|
key: `${d.name}-${i}-${index}`,
|
|
87
128
|
value,
|
|
88
129
|
position: index,
|
|
89
|
-
serie: d.name
|
|
130
|
+
serie: d.name,
|
|
131
|
+
scale: d.scale
|
|
90
132
|
})).filter((datum) => datum.value !== null && datum.value !== void 0)
|
|
91
133
|
})),
|
|
92
134
|
[hiddenSeries, series]
|
|
93
135
|
);
|
|
94
136
|
const stackedData = (0, import_react.useMemo)(() => (0, import_helpers.stackData)(groupsStacked, currentData), [groupsStacked, currentData]);
|
|
95
|
-
const containerRatio = props?.xAxis.advanced?.pointSpacing?.value ?? props?.yAxis.advanced?.pointSpacing?.value ?? 1;
|
|
96
137
|
const groups = (0, import_react.useMemo)(() => currentData.map((serie) => serie.name), [currentData]);
|
|
97
138
|
const { xScale, yScale, y2Scale, subGroupScale, colorScale, getBandwidth } = (0, import_useScales.useScales)({
|
|
98
139
|
props,
|
|
@@ -109,7 +150,8 @@ const useChart = (props) => {
|
|
|
109
150
|
yAxis,
|
|
110
151
|
isHorizontal,
|
|
111
152
|
xScale,
|
|
112
|
-
yScale
|
|
153
|
+
yScale,
|
|
154
|
+
y2Scale
|
|
113
155
|
});
|
|
114
156
|
const chartId = (0, import_react.useMemo)(() => (0, import_uuid.v4)(), []);
|
|
115
157
|
return (0, import_react.useMemo)(
|
|
@@ -140,11 +182,12 @@ const useChart = (props) => {
|
|
|
140
182
|
setXScrollbarPosition,
|
|
141
183
|
isGrabbed,
|
|
142
184
|
setIsGrabbed,
|
|
185
|
+
setContainerRef,
|
|
143
186
|
startPosition,
|
|
144
187
|
setStartPosition,
|
|
145
188
|
isScrollbarVisible,
|
|
146
189
|
setIsScrollbarVisible,
|
|
147
|
-
|
|
190
|
+
lastPosition,
|
|
148
191
|
containerRatio,
|
|
149
192
|
internalMargin,
|
|
150
193
|
axisLeftRef,
|
|
@@ -173,64 +216,58 @@ const useChart = (props) => {
|
|
|
173
216
|
leftLabel,
|
|
174
217
|
chartId,
|
|
175
218
|
hiddenSeries,
|
|
176
|
-
setHiddenSeries
|
|
219
|
+
setHiddenSeries,
|
|
220
|
+
height,
|
|
221
|
+
width,
|
|
222
|
+
setContainerRatio,
|
|
223
|
+
toolbarHeight,
|
|
224
|
+
setToolbarRef
|
|
177
225
|
}),
|
|
178
226
|
[
|
|
179
227
|
props,
|
|
180
|
-
currentData,
|
|
181
228
|
innerHeight,
|
|
182
229
|
innerWidth,
|
|
183
230
|
groups,
|
|
231
|
+
currentData,
|
|
184
232
|
colorScale,
|
|
185
233
|
stackedData,
|
|
186
234
|
subGroupScale,
|
|
187
|
-
scrapperPosX,
|
|
188
|
-
setScrapperPosX,
|
|
189
235
|
xScale,
|
|
190
236
|
yScale,
|
|
191
237
|
y2Scale,
|
|
238
|
+
containerRef,
|
|
192
239
|
getBandwidth,
|
|
193
240
|
scrapperPosY,
|
|
241
|
+
scrapperPosX,
|
|
194
242
|
activePoint,
|
|
195
243
|
activeSerie,
|
|
196
244
|
xScrollbarPosition,
|
|
197
|
-
setXScrollbarPosition,
|
|
198
245
|
isGrabbed,
|
|
199
|
-
setIsGrabbed,
|
|
200
246
|
startPosition,
|
|
201
|
-
setStartPosition,
|
|
202
|
-
rightLabelWidth,
|
|
203
|
-
rightLegend,
|
|
204
|
-
bottomLabelHeight,
|
|
205
247
|
isScrollbarVisible,
|
|
206
|
-
setIsScrollbarVisible,
|
|
207
|
-
oldLastPosition,
|
|
208
248
|
containerRatio,
|
|
209
249
|
internalMargin,
|
|
210
|
-
axisBottomHeight,
|
|
211
250
|
axisLeftRef,
|
|
212
251
|
leftLegendWidth,
|
|
213
252
|
leftLegend,
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
setRightLabel,
|
|
222
|
-
setBottomLabel,
|
|
253
|
+
rightLegend,
|
|
254
|
+
axisBottomHeight,
|
|
255
|
+
getXScaleValue,
|
|
256
|
+
getYScaleValue,
|
|
257
|
+
bottomLabelHeight,
|
|
258
|
+
rightLabelWidth,
|
|
259
|
+
axisRightWidth,
|
|
223
260
|
getXValue,
|
|
224
261
|
getYValue,
|
|
225
262
|
isHorizontal,
|
|
226
|
-
axisRightWidth,
|
|
227
|
-
setLeftLabel,
|
|
228
263
|
leftLabel,
|
|
229
264
|
chartId,
|
|
230
265
|
hiddenSeries,
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
266
|
+
height,
|
|
267
|
+
width,
|
|
268
|
+
setContainerRatio,
|
|
269
|
+
toolbarHeight,
|
|
270
|
+
setToolbarRef
|
|
234
271
|
]
|
|
235
272
|
);
|
|
236
273
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/graphs/Chart/config/useChart.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable max-nested-callbacks */\n/* eslint-disable max-statements */\n/* eslint-disable indent */\nimport { useMemo, useState, useRef } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\nimport { ScaleBand } from 'd3';\n// import {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable max-nested-callbacks */\n/* eslint-disable max-statements */\n/* eslint-disable indent */\nimport { useMemo, useState, useEffect, useRef } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\nimport { debounce } from 'lodash';\nimport { ScaleBand } from 'd3';\n// import { useResizeObserver } from '@elliemae/ds-utilities';\nimport type { DSChartT } from '../react-desc-prop-types';\n// import { propTypes } from '../react-desc-prop-types';\nimport { useScales } from './useScales';\nimport { stackData } from '../helpers';\nimport { useInternalMargins } from './useInternalMargins';\nimport { useGetters } from './useGetters';\n\nconst useResizeObserver = (ref) => {\n const [dimensions, setDimensions] = useState(null);\n const firstRender = useRef(true);\n useEffect(() => {\n const observeTarget = ref?.current || ref;\n\n if (firstRender.current) {\n firstRender.current = false;\n return () => {};\n }\n const resizeObserver = new ResizeObserver(\n debounce((entries) => {\n entries.forEach((entry) => {\n setDimensions(entry.contentRect);\n });\n }, 200),\n );\n resizeObserver.observe(observeTarget);\n\n return () => {\n resizeObserver.unobserve(observeTarget);\n };\n }, [ref]);\n return dimensions;\n};\n\nexport const useChart = (props: DSChartT.Props) => {\n // useValidateTypescriptPropTypes(props, propTypes);\n\n const { series, yAxis, xAxis, width: userWidth, height: userHeight, groups: groupsStacked } = props;\n\n const [containerRef, setContainerRef] = useState<HTMLDivElement>(null);\n const svgRef = useRef(null);\n\n const dimensions = useResizeObserver(containerRef?.parentElement);\n const width = useMemo(() => userWidth ?? dimensions?.width ?? 0, [dimensions, userWidth]);\n\n const height = useMemo(() => userHeight ?? 500, [userHeight]);\n\n // useResizeObserver(({ width: newWidth, height: newHeight }) => {\n // setResizeWidth(newWidth);\n // }, containerRef?.parentElement);\n\n const [isGrabbed, setIsGrabbed] = useState(false);\n const [startPosition, setStartPosition] = useState(0);\n\n const [activePoint, setActivePoint] = useState(null);\n const [activeSerie, setActiveSerie] = useState('');\n const [scrapperPosY, setScrapperPosY] = useState('');\n const [scrapperPosX, setScrapperPosX] = useState('');\n const [xScrollbarPosition, setXScrollbarPosition] = useState(0);\n const [isScrollbarVisible, setIsScrollbarVisible] = useState(false);\n const [containerRatio, setContainerRatio] = useState(\n props?.xAxis.advanced?.pointSpacing?.value ?? props?.yAxis.advanced?.pointSpacing?.value ?? 1,\n );\n\n const lastPosition = useRef(0);\n\n const [axisLeftRef, setAxisLeftRef] = useState<SVGGElement | null>(null);\n const [axisBottomRef, setAxisBottomRef] = useState<SVGGElement | null>(null);\n const [axisRightRef, setAxisRightRef] = useState<SVGGElement | null>(null);\n\n const [leftLegend, setLeftLegend] = useState<SVGGElement | null>(null);\n const [rightLegend, setRightLegend] = useState<SVGGElement | null>(null);\n const [topLegend, setTopLegend] = useState<SVGGElement | null>(null);\n const [bottomLegend, setBottomLegend] = useState<SVGGElement | null>(null);\n\n const [rightLabel, setRightLabel] = useState<SVGGElement | null>(null);\n const [leftLabel, setLeftLabel] = useState<SVGGElement | null>(null);\n const [bottomLabel, setBottomLabel] = useState<SVGGElement | null>(null);\n\n const [toolbarRef, setToolbarRef] = useState<SVGGElement | null>(null);\n\n const {\n toolbarHeight,\n axisBottomHeight,\n axisRightWidth,\n bottomLabelHeight,\n internalMargin,\n leftLegendWidth,\n rightLabelWidth,\n } = useInternalMargins({\n axisLeftRef,\n axisBottomRef,\n axisRightRef,\n leftLabel,\n leftLegend,\n rightLegend,\n topLegend,\n bottomLegend,\n rightLabel,\n bottomLabel,\n toolbarRef,\n });\n\n const innerWidth = useMemo(\n () => width - internalMargin.left - internalMargin.right,\n [internalMargin.left, internalMargin.right, width],\n );\n const innerHeight = useMemo(\n () => height - internalMargin.top - internalMargin.bottom,\n [internalMargin.top, internalMargin.bottom, height],\n );\n\n const [hiddenSeries, setHiddenSeries] = useState<string[]>([]);\n\n const currentData = useMemo(\n () =>\n series\n .filter((serie) => !hiddenSeries.includes(serie.name))\n .map((d, i) => ({\n ...d,\n key: `${d.name}-${i}`,\n data: d.data\n .map((value, index) => ({\n key: `${d.name}-${i}-${index}`,\n value,\n position: index,\n serie: d.name,\n scale: d.scale,\n }))\n .filter((datum) => datum.value !== null && datum.value !== undefined),\n })),\n [hiddenSeries, series],\n );\n\n const stackedData = useMemo(() => stackData(groupsStacked, currentData), [groupsStacked, currentData]);\n\n // @TODO we need to create a logic to get this from both axis\n // const containerRatio = props?.xAxis.advanced?.pointSpacing?.value ?? props?.yAxis.advanced?.pointSpacing?.value ?? 1;\n\n const groups = useMemo(() => currentData.map((serie) => serie.name), [currentData]);\n\n const { xScale, yScale, y2Scale, subGroupScale, colorScale, getBandwidth } = useScales({\n props,\n innerHeight,\n innerWidth,\n groups,\n stackedData,\n currentData,\n containerRatio,\n });\n\n const isHorizontal = useMemo(() => !!(yScale as ScaleBand<string>).bandwidth, [yScale]);\n\n const { getXValue, getYValue, getXScaleValue, getYScaleValue } = useGetters({\n xAxis,\n yAxis,\n isHorizontal,\n xScale,\n yScale,\n y2Scale,\n });\n const chartId = useMemo(() => uuidv4(), []);\n\n return useMemo(\n () => ({\n props,\n innerHeight,\n innerWidth,\n groups,\n currentData,\n colorScale,\n stackedData,\n subGroupScale,\n svgRef,\n xScale,\n yScale,\n y2Scale,\n containerRef,\n getBandwidth,\n scrapperPosY,\n setScrapperPosY,\n scrapperPosX,\n setScrapperPosX,\n activePoint,\n setActivePoint,\n activeSerie,\n setActiveSerie,\n xScrollbarPosition,\n setXScrollbarPosition,\n isGrabbed,\n setIsGrabbed,\n setContainerRef,\n startPosition,\n setStartPosition,\n isScrollbarVisible,\n setIsScrollbarVisible,\n lastPosition,\n containerRatio,\n internalMargin,\n axisLeftRef,\n leftLegendWidth,\n leftLegend,\n setAxisLeftRef,\n setLeftLegend,\n setRightLegend,\n rightLegend,\n setTopLegend,\n setBottomLegend,\n setAxisBottomRef,\n axisBottomHeight,\n setAxisRightRef,\n setRightLabel,\n setBottomLabel,\n getXScaleValue,\n getYScaleValue,\n bottomLabelHeight,\n rightLabelWidth,\n axisRightWidth,\n getXValue,\n getYValue,\n isHorizontal,\n setLeftLabel,\n leftLabel,\n chartId,\n hiddenSeries,\n setHiddenSeries,\n height,\n width,\n setContainerRatio,\n toolbarHeight,\n setToolbarRef,\n }),\n [\n props,\n innerHeight,\n innerWidth,\n groups,\n currentData,\n colorScale,\n stackedData,\n subGroupScale,\n xScale,\n yScale,\n y2Scale,\n containerRef,\n getBandwidth,\n scrapperPosY,\n scrapperPosX,\n activePoint,\n activeSerie,\n xScrollbarPosition,\n isGrabbed,\n startPosition,\n isScrollbarVisible,\n containerRatio,\n internalMargin,\n axisLeftRef,\n leftLegendWidth,\n leftLegend,\n rightLegend,\n axisBottomHeight,\n getXScaleValue,\n getYScaleValue,\n bottomLabelHeight,\n rightLabelWidth,\n axisRightWidth,\n getXValue,\n getYValue,\n isHorizontal,\n leftLabel,\n chartId,\n hiddenSeries,\n height,\n width,\n setContainerRatio,\n toolbarHeight,\n setToolbarRef,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,mBAAqD;AACrD,kBAA6B;AAC7B,oBAAyB;AAKzB,uBAA0B;AAC1B,qBAA0B;AAC1B,gCAAmC;AACnC,wBAA2B;AAE3B,MAAM,oBAAoB,CAAC,QAAQ;AACjC,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,IAAI;AACjD,QAAM,kBAAc,qBAAO,IAAI;AAC/B,8BAAU,MAAM;AACd,UAAM,gBAAgB,KAAK,WAAW;AAEtC,QAAI,YAAY,SAAS;AACvB,kBAAY,UAAU;AACtB,aAAO,MAAM;AAAA,MAAC;AAAA,IAChB;AACA,UAAM,iBAAiB,IAAI;AAAA,UACzB,wBAAS,CAAC,YAAY;AACpB,gBAAQ,QAAQ,CAAC,UAAU;AACzB,wBAAc,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A,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": ["uuidv4"]
|
|
7
7
|
}
|
|
@@ -29,7 +29,7 @@ __export(useGetters_exports, {
|
|
|
29
29
|
module.exports = __toCommonJS(useGetters_exports);
|
|
30
30
|
var React = __toESM(require("react"));
|
|
31
31
|
var import_react = require("react");
|
|
32
|
-
const useGetters = ({ xAxis, isHorizontal, yAxis, xScale, yScale }) => {
|
|
32
|
+
const useGetters = ({ xAxis, isHorizontal, yAxis, xScale, yScale, y2Scale }) => {
|
|
33
33
|
const getXValue = (0, import_react.useCallback)(
|
|
34
34
|
(datum) => {
|
|
35
35
|
if (!isHorizontal) {
|
|
@@ -75,12 +75,13 @@ const useGetters = ({ xAxis, isHorizontal, yAxis, xScale, yScale }) => {
|
|
|
75
75
|
);
|
|
76
76
|
const getYScaleValue = (0, import_react.useCallback)(
|
|
77
77
|
(datum) => {
|
|
78
|
+
const finalYScale = datum?.scale === "y2" ? y2Scale : yScale;
|
|
78
79
|
if (yAxis.type === "band") {
|
|
79
|
-
return
|
|
80
|
+
return finalYScale(getYValue(datum));
|
|
80
81
|
}
|
|
81
|
-
return
|
|
82
|
+
return finalYScale(getYValue(datum));
|
|
82
83
|
},
|
|
83
|
-
[getYValue, yAxis.type, yScale]
|
|
84
|
+
[getYValue, y2Scale, yAxis.type, yScale]
|
|
84
85
|
);
|
|
85
86
|
return (0, import_react.useMemo)(
|
|
86
87
|
() => ({ getYValue, getXValue, getXScaleValue, getYScaleValue }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/graphs/Chart/config/useGetters.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable max-depth */\n/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport { useCallback, useMemo } from 'react';\nimport { ScaleBand, ScaleLinear } from 'd3';\nimport { DSChartT } from '../react-desc-prop-types';\n\ninterface UseGettersT {\n xAxis: DSChartT.AxisT;\n yAxis: DSChartT.AxisT;\n isHorizontal: boolean;\n xScale: DSChartT.Scales;\n yScale: DSChartT.Scales;\n}\nexport const useGetters = ({ xAxis, isHorizontal, yAxis, xScale, yScale }: UseGettersT) => {\n const getXValue = useCallback(\n (datum: DSChartT.InternalDatum) => {\n if (!isHorizontal) {\n if (xAxis?.cols?.[datum.position]) {\n return xAxis?.cols?.[datum.position];\n }\n if (typeof datum.value === 'object') return datum.value?.x;\n return datum.position.toString();\n }\n if (typeof datum.value === 'number') {\n return datum.value;\n }\n return datum.value?.x;\n },\n [isHorizontal, xAxis?.cols],\n );\n\n const getYValue = useCallback(\n (datum: DSChartT.InternalDatum) => {\n if (!isHorizontal) {\n if (typeof datum.value === 'number') {\n return datum.value;\n }\n return datum.value?.y;\n }\n if (yAxis?.cols?.[datum.position]) {\n return yAxis?.cols?.[datum.position];\n }\n if (typeof datum.value === 'object') return datum.value?.y;\n return datum.position.toString();\n },\n [isHorizontal, yAxis?.cols],\n );\n\n const getXScaleValue = useCallback(\n (datum: DSChartT.InternalDatum) => {\n if (xAxis.type === 'linear') {\n return (xScale as ScaleLinear<number, number, never>)(getXValue(datum) as number);\n }\n return (xScale as ScaleBand<string>)(getXValue(datum) as string);\n },\n [getXValue, xAxis.type, xScale],\n );\n\n const getYScaleValue = useCallback(\n (datum: DSChartT.InternalDatum) => {\n if (yAxis.type === 'band') {\n return (
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,mBAAqC;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable max-depth */\n/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport { useCallback, useMemo } from 'react';\nimport { ScaleBand, ScaleLinear } from 'd3';\nimport { DSChartT } from '../react-desc-prop-types';\n\ninterface UseGettersT {\n xAxis: DSChartT.AxisT;\n yAxis: DSChartT.AxisT;\n isHorizontal: boolean;\n xScale: DSChartT.Scales;\n yScale: DSChartT.Scales;\n y2Scale: DSChartT.Scales;\n}\nexport const useGetters = ({ xAxis, isHorizontal, yAxis, xScale, yScale, y2Scale }: UseGettersT) => {\n const getXValue = useCallback(\n (datum: DSChartT.InternalDatum) => {\n if (!isHorizontal) {\n if (xAxis?.cols?.[datum.position]) {\n return xAxis?.cols?.[datum.position];\n }\n if (typeof datum.value === 'object') return datum.value?.x;\n return datum.position.toString();\n }\n if (typeof datum.value === 'number') {\n return datum.value;\n }\n return datum.value?.x;\n },\n [isHorizontal, xAxis?.cols],\n );\n\n const getYValue = useCallback(\n (datum: DSChartT.InternalDatum) => {\n if (!isHorizontal) {\n if (typeof datum.value === 'number') {\n return datum.value;\n }\n return datum.value?.y;\n }\n if (yAxis?.cols?.[datum.position]) {\n return yAxis?.cols?.[datum.position];\n }\n if (typeof datum.value === 'object') return datum.value?.y;\n return datum.position.toString();\n },\n [isHorizontal, yAxis?.cols],\n );\n\n const getXScaleValue = useCallback(\n (datum: DSChartT.InternalDatum) => {\n if (xAxis.type === 'linear') {\n return (xScale as ScaleLinear<number, number, never>)(getXValue(datum) as number);\n }\n return (xScale as ScaleBand<string>)(getXValue(datum) as string);\n },\n [getXValue, xAxis.type, xScale],\n );\n\n const getYScaleValue = useCallback(\n (datum: DSChartT.InternalDatum) => {\n const finalYScale = datum?.scale === 'y2' ? y2Scale : yScale;\n if (yAxis.type === 'band') {\n return (finalYScale as ScaleBand<string>)(getYValue(datum) as string);\n }\n return (finalYScale as ScaleLinear<number, number, never>)(getYValue(datum) as number);\n },\n [getYValue, y2Scale, yAxis.type, yScale],\n );\n\n return useMemo(\n () => ({ getYValue, getXValue, getXScaleValue, getYScaleValue }),\n [getYValue, getXValue, getXScaleValue, getYScaleValue],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,mBAAqC;AAY9B,MAAM,aAAa,CAAC,EAAE,OAAO,cAAc,OAAO,QAAQ,QAAQ,QAAQ,MAAmB;AAClG,QAAM,gBAAY;AAAA,IAChB,CAAC,UAAkC;AACjC,UAAI,CAAC,cAAc;AACjB,YAAI,OAAO,OAAO,MAAM,WAAW;AACjC,iBAAO,OAAO,OAAO,MAAM;AAAA,QAC7B;AACA,YAAI,OAAO,MAAM,UAAU;AAAU,iBAA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
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -39,7 +39,8 @@ const useInternalMargins = ({
|
|
|
39
39
|
topLegend,
|
|
40
40
|
bottomLegend,
|
|
41
41
|
rightLabel,
|
|
42
|
-
bottomLabel
|
|
42
|
+
bottomLabel,
|
|
43
|
+
toolbarRef
|
|
43
44
|
}) => {
|
|
44
45
|
const axisLeftWidth = (0, import_react.useMemo)(() => axisLeftRef?.getBoundingClientRect()?.width || 0, [axisLeftRef]);
|
|
45
46
|
const axisBottomHeight = (0, import_react.useMemo)(() => axisBottomRef?.getBoundingClientRect()?.height || 0, [axisBottomRef]);
|
|
@@ -51,10 +52,11 @@ const useInternalMargins = ({
|
|
|
51
52
|
const bottomLegendHeight = (0, import_react.useMemo)(() => bottomLegend?.getBoundingClientRect()?.height || 0, [bottomLegend]);
|
|
52
53
|
const rightLegendWidth = (0, import_react.useMemo)(() => rightLegend?.getBoundingClientRect()?.width || 0, [rightLegend]);
|
|
53
54
|
const leftLegendWidth = (0, import_react.useMemo)(() => leftLegend?.getBoundingClientRect()?.width || 0, [leftLegend]);
|
|
55
|
+
const toolbarHeight = (0, import_react.useMemo)(() => toolbarRef?.getBoundingClientRect()?.height || 0, [toolbarRef]);
|
|
54
56
|
const internalMargin = (0, import_react.useMemo)(
|
|
55
57
|
() => ({
|
|
56
58
|
bottom: 10 + axisBottomHeight + bottomLegendHeight + bottomLabelHeight,
|
|
57
|
-
top: 10 + topLegendHeight,
|
|
59
|
+
top: 10 + topLegendHeight + toolbarHeight,
|
|
58
60
|
right: 15 + rightLabelWidth + axisRightWidth + rightLegendWidth,
|
|
59
61
|
left: 10 + axisLeftWidth + leftLabelWidth + leftLegendWidth
|
|
60
62
|
}),
|
|
@@ -63,6 +65,7 @@ const useInternalMargins = ({
|
|
|
63
65
|
bottomLegendHeight,
|
|
64
66
|
bottomLabelHeight,
|
|
65
67
|
topLegendHeight,
|
|
68
|
+
toolbarHeight,
|
|
66
69
|
rightLabelWidth,
|
|
67
70
|
axisRightWidth,
|
|
68
71
|
rightLegendWidth,
|
|
@@ -83,10 +86,12 @@ const useInternalMargins = ({
|
|
|
83
86
|
axisRightWidth,
|
|
84
87
|
rightLegendWidth,
|
|
85
88
|
axisLeftWidth,
|
|
86
|
-
leftLabelWidth
|
|
89
|
+
leftLabelWidth,
|
|
90
|
+
toolbarHeight
|
|
87
91
|
}),
|
|
88
92
|
[
|
|
89
93
|
axisBottomHeight,
|
|
94
|
+
toolbarHeight,
|
|
90
95
|
axisLeftWidth,
|
|
91
96
|
axisRightWidth,
|
|
92
97
|
bottomLabelHeight,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/graphs/Chart/config/useInternalMargins.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-statements */\n/* eslint-disable indent */\nimport { useMemo } from 'react';\n\ninterface UseInternalMarginsT {\n axisLeftRef: SVGGElement | null;\n axisBottomRef: SVGGElement | null;\n axisRightRef: SVGGElement | null;\n leftLegend: SVGGElement | null;\n leftLabel: SVGGElement | null;\n rightLegend: SVGGElement | null;\n topLegend: SVGGElement | null;\n bottomLegend: SVGGElement | null;\n rightLabel: SVGGElement | null;\n bottomLabel: SVGGElement | null;\n}\nexport const useInternalMargins = ({\n axisLeftRef,\n axisBottomRef,\n axisRightRef,\n leftLabel,\n leftLegend,\n rightLegend,\n topLegend,\n bottomLegend,\n rightLabel,\n bottomLabel,\n}: UseInternalMarginsT) => {\n // Axis\n const axisLeftWidth = useMemo(() => axisLeftRef?.getBoundingClientRect()?.width || 0, [axisLeftRef]);\n const axisBottomHeight = useMemo(() => axisBottomRef?.getBoundingClientRect()?.height || 0, [axisBottomRef]);\n const axisRightWidth = useMemo(() => axisRightRef?.getBoundingClientRect()?.width || 0, [axisRightRef]);\n\n // Labels\n const bottomLabelHeight = useMemo(() => bottomLabel?.getBoundingClientRect()?.height || 0, [bottomLabel]);\n const rightLabelWidth = useMemo(() => rightLabel?.getBoundingClientRect()?.width || 0, [rightLabel]);\n const leftLabelWidth = useMemo(() => leftLabel?.getBoundingClientRect()?.width || 0, [leftLabel]);\n\n // Legends\n const topLegendHeight = useMemo(() => topLegend?.getBoundingClientRect()?.height || 0, [topLegend]);\n const bottomLegendHeight = useMemo(() => bottomLegend?.getBoundingClientRect()?.height || 0, [bottomLegend]);\n const rightLegendWidth = useMemo(() => rightLegend?.getBoundingClientRect()?.width || 0, [rightLegend]);\n const leftLegendWidth = useMemo(() => leftLegend?.getBoundingClientRect()?.width || 0, [leftLegend]);\n\n const internalMargin = useMemo(\n () => ({\n bottom: 10 + axisBottomHeight + bottomLegendHeight + bottomLabelHeight,\n top: 10 + topLegendHeight,\n right: 15 + rightLabelWidth + axisRightWidth + rightLegendWidth,\n left: 10 + axisLeftWidth + leftLabelWidth + leftLegendWidth,\n }),\n\n [\n axisBottomHeight,\n bottomLegendHeight,\n bottomLabelHeight,\n topLegendHeight,\n rightLabelWidth,\n axisRightWidth,\n rightLegendWidth,\n axisLeftWidth,\n leftLabelWidth,\n leftLegendWidth,\n ],\n );\n\n return useMemo(\n () => ({\n internalMargin,\n leftLegendWidth,\n axisBottomHeight,\n bottomLegendHeight,\n bottomLabelHeight,\n topLegendHeight,\n rightLabelWidth,\n axisRightWidth,\n rightLegendWidth,\n axisLeftWidth,\n leftLabelWidth,\n }),\n [\n axisBottomHeight,\n axisLeftWidth,\n axisRightWidth,\n bottomLabelHeight,\n bottomLegendHeight,\n internalMargin,\n leftLabelWidth,\n leftLegendWidth,\n rightLabelWidth,\n rightLegendWidth,\n topLegendHeight,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAwB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-statements */\n/* eslint-disable indent */\nimport { useMemo } from 'react';\n\ninterface UseInternalMarginsT {\n axisLeftRef: SVGGElement | null;\n axisBottomRef: SVGGElement | null;\n axisRightRef: SVGGElement | null;\n leftLegend: SVGGElement | null;\n leftLabel: SVGGElement | null;\n rightLegend: SVGGElement | null;\n topLegend: SVGGElement | null;\n bottomLegend: SVGGElement | null;\n rightLabel: SVGGElement | null;\n bottomLabel: SVGGElement | null;\n toolbarRef: SVGGElement | null;\n}\nexport const useInternalMargins = ({\n axisLeftRef,\n axisBottomRef,\n axisRightRef,\n leftLabel,\n leftLegend,\n rightLegend,\n topLegend,\n bottomLegend,\n rightLabel,\n bottomLabel,\n toolbarRef,\n}: UseInternalMarginsT) => {\n // Axis\n const axisLeftWidth = useMemo(() => axisLeftRef?.getBoundingClientRect()?.width || 0, [axisLeftRef]);\n const axisBottomHeight = useMemo(() => axisBottomRef?.getBoundingClientRect()?.height || 0, [axisBottomRef]);\n const axisRightWidth = useMemo(() => axisRightRef?.getBoundingClientRect()?.width || 0, [axisRightRef]);\n\n // Labels\n const bottomLabelHeight = useMemo(() => bottomLabel?.getBoundingClientRect()?.height || 0, [bottomLabel]);\n const rightLabelWidth = useMemo(() => rightLabel?.getBoundingClientRect()?.width || 0, [rightLabel]);\n const leftLabelWidth = useMemo(() => leftLabel?.getBoundingClientRect()?.width || 0, [leftLabel]);\n\n // Legends\n const topLegendHeight = useMemo(() => topLegend?.getBoundingClientRect()?.height || 0, [topLegend]);\n const bottomLegendHeight = useMemo(() => bottomLegend?.getBoundingClientRect()?.height || 0, [bottomLegend]);\n const rightLegendWidth = useMemo(() => rightLegend?.getBoundingClientRect()?.width || 0, [rightLegend]);\n const leftLegendWidth = useMemo(() => leftLegend?.getBoundingClientRect()?.width || 0, [leftLegend]);\n\n const toolbarHeight = useMemo(() => toolbarRef?.getBoundingClientRect()?.height || 0, [toolbarRef]);\n\n const internalMargin = useMemo(\n () => ({\n bottom: 10 + axisBottomHeight + bottomLegendHeight + bottomLabelHeight,\n top: 10 + topLegendHeight + toolbarHeight,\n right: 15 + rightLabelWidth + axisRightWidth + rightLegendWidth,\n left: 10 + axisLeftWidth + leftLabelWidth + leftLegendWidth,\n }),\n\n [\n axisBottomHeight,\n bottomLegendHeight,\n bottomLabelHeight,\n topLegendHeight,\n toolbarHeight,\n rightLabelWidth,\n axisRightWidth,\n rightLegendWidth,\n axisLeftWidth,\n leftLabelWidth,\n leftLegendWidth,\n ],\n );\n\n return useMemo(\n () => ({\n internalMargin,\n leftLegendWidth,\n axisBottomHeight,\n bottomLegendHeight,\n bottomLabelHeight,\n topLegendHeight,\n rightLabelWidth,\n axisRightWidth,\n rightLegendWidth,\n axisLeftWidth,\n leftLabelWidth,\n toolbarHeight,\n }),\n [\n axisBottomHeight,\n toolbarHeight,\n axisLeftWidth,\n axisRightWidth,\n bottomLabelHeight,\n bottomLegendHeight,\n internalMargin,\n leftLabelWidth,\n leftLegendWidth,\n rightLabelWidth,\n rightLegendWidth,\n topLegendHeight,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAwB;AAejB,MAAM,qBAAqB,CAAC;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA2B;AAEzB,QAAM,oBAAgB,sBAAQ,MAAM,aAAa,sBAAsB,GAAG,SAAS,GAAG,CAAC,WAAW,CAAC;AACnG,QAAM,uBAAmB,sBAAQ,MAAM,eAAe,sBAAsB,GAAG,UAAU,GAAG,CAAC,aAAa,CAAC;AAC3G,QAAM,qBAAiB,sBAAQ,MAAM,cAAc,sBAAsB,GAAG,SAAS,GAAG,CAAC,YAAY,CAAC;AAGtG,QAAM,wBAAoB,sBAAQ,MAAM,aAAa,sBAAsB,GAAG,UAAU,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;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -69,7 +69,7 @@ const useKeyboardNavigation = () => {
|
|
|
69
69
|
);
|
|
70
70
|
const handleOnFocus = (0, import_react.useCallback)(
|
|
71
71
|
(e) => {
|
|
72
|
-
if (containerRef
|
|
72
|
+
if (containerRef === e.target) {
|
|
73
73
|
setActivePoint(currentSerie?.data[0]);
|
|
74
74
|
setXScrollbarPosition(0);
|
|
75
75
|
}
|
|
@@ -78,7 +78,7 @@ const useKeyboardNavigation = () => {
|
|
|
78
78
|
);
|
|
79
79
|
const handleOnBlur = (0, import_react.useCallback)(() => {
|
|
80
80
|
setTimeout(() => {
|
|
81
|
-
if (!containerRef
|
|
81
|
+
if (!containerRef.contains(document.activeElement) || containerRef === document.activeElement) {
|
|
82
82
|
setActivePoint(null);
|
|
83
83
|
}
|
|
84
84
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/graphs/Chart/config/useKeyboardNavigation.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable max-depth */\n/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport { useCallback, useContext, useMemo } from 'react';\nimport { ChartContext } from '../ChartContext';\nimport { FOCUS_RING } from '../../constants';\nexport const findInCircularList = (\n list: string[],\n from: number,\n step = 1,\n // eslint-disable-next-line max-params\n): number => {\n for (\n let i = (from + step + list.length) % list.length;\n i !== from && from > -1;\n i = (i + step + list.length) % list.length\n ) {\n if (list[i]) return i;\n }\n return from; // return same item\n};\n\nexport const useKeyboardNavigation = () => {\n const {\n activePoint,\n setActivePoint,\n containerRef,\n yScale,\n setXScrollbarPosition,\n containerRatio,\n xScrollbarPosition,\n innerWidth,\n innerHeight,\n getYValue,\n getXScaleValue,\n getYScaleValue,\n groups,\n currentData: data,\n props: { xAxis, yAxis },\n } = useContext(ChartContext);\n\n const xScroll = xAxis.advanced?.pointSpacing?.value > 1;\n const yScroll = yAxis.advanced?.pointSpacing?.value > 1;\n\n const currentSerie = useMemo(\n () => data.find((d) => d.name === activePoint?.serie) ?? data[0],\n [activePoint?.serie, data],\n );\n\n const currentActiveItemIndex = useMemo(\n () => currentSerie?.data.findIndex((opt) => opt.key === activePoint?.key),\n [activePoint, currentSerie],\n );\n\n const handleOnFocus: React.FocusEventHandler<HTMLDivElement> = useCallback(\n (e) => {\n if (containerRef
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,mBAAiD;AACjD,0BAA6B;AAC7B,uBAA2B;AACpB,MAAM,qBAAqB,CAChC,MACA,MACA,OAAO,MAEI;AACX,WACM,KAAK,OAAO,OAAO,KAAK,UAAU,KAAK,QAC3C,MAAM,QAAQ,OAAO,IACrB,KAAK,IAAI,OAAO,KAAK,UAAU,KAAK,QACpC;AACA,QAAI,KAAK;AAAI,aAAO;AAAA,EACtB;AACA,SAAO;AACT;AAEO,MAAM,wBAAwB,MAAM;AACzC,QAAM;AAAA,IACJ;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;AAAA,IACb,OAAO,EAAE,OAAO,MAAM;AAAA,EACxB,QAAI,yBAAW,gCAAY;AAE3B,QAAM,UAAU,MAAM,UAAU,cAAc,QAAQ;AACtD,QAAM,UAAU,MAAM,UAAU,cAAc,QAAQ;AAEtD,QAAM,mBAAe;AAAA,IACnB,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE,SAAS,aAAa,KAAK,KAAK,KAAK;AAAA,IAC9D,CAAC,aAAa,OAAO,IAAI;AAAA,EAC3B;AAEA,QAAM,6BAAyB;AAAA,IAC7B,MAAM,cAAc,KAAK,UAAU,CAAC,QAAQ,IAAI,QAAQ,aAAa,GAAG;AAAA,IACxE,CAAC,aAAa,YAAY;AAAA,EAC5B;AAEA,QAAM,oBAAyD;AAAA,IAC7D,CAAC,MAAM;AACL,UAAI,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable max-depth */\n/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport { useCallback, useContext, useMemo } from 'react';\nimport { ChartContext } from '../ChartContext';\nimport { FOCUS_RING } from '../../constants';\nexport const findInCircularList = (\n list: string[],\n from: number,\n step = 1,\n // eslint-disable-next-line max-params\n): number => {\n for (\n let i = (from + step + list.length) % list.length;\n i !== from && from > -1;\n i = (i + step + list.length) % list.length\n ) {\n if (list[i]) return i;\n }\n return from; // return same item\n};\n\nexport const useKeyboardNavigation = () => {\n const {\n activePoint,\n setActivePoint,\n containerRef,\n yScale,\n setXScrollbarPosition,\n containerRatio,\n xScrollbarPosition,\n innerWidth,\n innerHeight,\n getYValue,\n getXScaleValue,\n getYScaleValue,\n groups,\n currentData: data,\n props: { xAxis, yAxis },\n } = useContext(ChartContext);\n\n const xScroll = xAxis.advanced?.pointSpacing?.value > 1;\n const yScroll = yAxis.advanced?.pointSpacing?.value > 1;\n\n const currentSerie = useMemo(\n () => data.find((d) => d.name === activePoint?.serie) ?? data[0],\n [activePoint?.serie, data],\n );\n\n const currentActiveItemIndex = useMemo(\n () => currentSerie?.data.findIndex((opt) => opt.key === activePoint?.key),\n [activePoint, currentSerie],\n );\n\n const handleOnFocus: React.FocusEventHandler<HTMLDivElement> = useCallback(\n (e) => {\n if (containerRef === e.target) {\n setActivePoint(currentSerie?.data[0]);\n setXScrollbarPosition(0);\n }\n },\n [containerRef, currentSerie?.data, setActivePoint, setXScrollbarPosition],\n );\n\n const handleOnBlur: React.FocusEventHandler<HTMLInputElement> = useCallback(() => {\n setTimeout(() => {\n if (!containerRef.contains(document.activeElement) || containerRef === document.activeElement) {\n setActivePoint(null);\n }\n });\n }, [containerRef, setActivePoint]);\n\n const navigateSerie = useCallback(\n (step: number) => {\n const newValue = findInCircularList(\n currentSerie?.data.map((d) => d.value.toString()),\n currentActiveItemIndex,\n step,\n );\n setActivePoint(currentSerie?.data[newValue]);\n if (xScroll) {\n const xValue = getXScaleValue(currentSerie?.data[newValue]);\n if (xValue === undefined) return;\n const barWidth = innerWidth / containerRatio;\n const total = innerWidth * containerRatio;\n if (total <= xValue) {\n // to go from the first to last\n setXScrollbarPosition((total - innerWidth) / containerRatio);\n } else if (xValue > xScrollbarPosition * containerRatio + innerWidth)\n // if is not visible we move the scroll to the next best position\n setXScrollbarPosition((prev) => {\n const nextPosition = prev + (xValue / containerRatio - prev);\n if (nextPosition + barWidth > innerWidth) return innerWidth - barWidth;\n return nextPosition;\n });\n // move backwards - 2 because focus ring in bars\n else if (xValue < xScrollbarPosition * containerRatio)\n setXScrollbarPosition(xValue / containerRatio - FOCUS_RING.STROKE_WIDTH);\n }\n if (yScroll) {\n const yValue = getYScaleValue(currentSerie?.data[newValue]);\n if (yValue === undefined) return;\n const barWidth = innerHeight / containerRatio;\n const total = innerHeight * containerRatio;\n if (total <= yValue) {\n // to go from the first to last\n setXScrollbarPosition((total - innerHeight) / containerRatio);\n } else if (yValue > xScrollbarPosition * containerRatio + innerHeight)\n // if is not visible we move the scroll to the next best position\n setXScrollbarPosition((prev) => {\n const nextPosition = prev + (yValue / containerRatio - prev);\n if (nextPosition + barWidth > innerHeight) return innerHeight - barWidth;\n return nextPosition;\n });\n // move backwards - 2 because focus ring in bars\n else if (yValue < xScrollbarPosition * containerRatio)\n setXScrollbarPosition(yValue / containerRatio - FOCUS_RING.STROKE_WIDTH);\n }\n },\n [\n currentSerie?.data,\n currentActiveItemIndex,\n setActivePoint,\n xScroll,\n yScroll,\n getXScaleValue,\n innerWidth,\n containerRatio,\n xScrollbarPosition,\n setXScrollbarPosition,\n getYScaleValue,\n innerHeight,\n ],\n );\n\n const changeSerie = useCallback(\n (step: number) => {\n const nextSerie = data.find((d) => {\n const nextSerieIndex = findInCircularList(\n groups,\n groups.findIndex((item) => item === currentSerie.name),\n step,\n );\n\n return d.name === groups[nextSerieIndex];\n });\n setActivePoint(nextSerie?.data[currentActiveItemIndex] || nextSerie?.data?.[0] || null);\n },\n [data, setActivePoint, currentActiveItemIndex, groups, currentSerie.name],\n );\n\n const onInputKeyDown: React.KeyboardEventHandler<HTMLInputElement> = useCallback(\n (e) => {\n if (e.code !== 'Tab') {\n e.preventDefault();\n }\n if (['ArrowLeft', 'ArrowRight'].includes(e.code)) {\n if (yScale.bandwidth) changeSerie(e.code === 'ArrowLeft' ? -1 : 1);\n else navigateSerie(e.code === 'ArrowLeft' ? -1 : 1);\n }\n\n if (['ArrowDown', 'ArrowUp'].includes(e.code)) {\n if (yScale.bandwidth) navigateSerie(e.code === 'ArrowDown' ? 1 : -1);\n else changeSerie(e.code === 'ArrowDown' ? -1 : 1);\n }\n },\n [changeSerie, navigateSerie, yScale.bandwidth],\n );\n\n return useMemo(\n () => ({ onInputKeyDown, handleOnBlur, handleOnFocus }),\n [handleOnBlur, handleOnFocus, onInputKeyDown],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,mBAAiD;AACjD,0BAA6B;AAC7B,uBAA2B;AACpB,MAAM,qBAAqB,CAChC,MACA,MACA,OAAO,MAEI;AACX,WACM,KAAK,OAAO,OAAO,KAAK,UAAU,KAAK,QAC3C,MAAM,QAAQ,OAAO,IACrB,KAAK,IAAI,OAAO,KAAK,UAAU,KAAK,QACpC;AACA,QAAI,KAAK;AAAI,aAAO;AAAA,EACtB;AACA,SAAO;AACT;AAEO,MAAM,wBAAwB,MAAM;AACzC,QAAM;AAAA,IAC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UAAU,CAAC,SAAS,SAAS,aAAa,IAAI;AAAA,UACrD;AAAA,QACF;AAEA,eAAO,EAAE,SAAS,OAAO;AAAA,MAC3B,CAAC;AACD,qBAAe,WAAW,KAAK,2BAA2B,WAAW,OAAO,MAAM,IAAI;AAAA,IACxF;AAAA,IACA,CAAC,MAAM,gBAAgB,wBAAwB,QAAQ,aAAa,IAAI;AAAA,EAC1E;AAEA,QAAM,qBAA+D;AAAA,IACnE,CAAC,MAAM;AACL,UAAI,EAAE,SAAS,OAAO;AACpB,UAAE,eAAe;AAAA,MACnB;AACA,UAAI,CAAC,aAAa,YAAY,EAAE,SAAS,EAAE,IAAI,GAAG;AAChD,YAAI,OAAO;AAAW,sBAAY,EAAE,SAAS,cAAc,KAAK,CAAC;AAAA;AAC5D,wBAAc,EAAE,SAAS,cAAc,KAAK,CAAC;AAAA,MACpD;AAEA,UAAI,CAAC,aAAa,SAAS,EAAE,SAAS,EAAE,IAAI,GAAG;AAC7C,YAAI,OAAO;AAAW,wBAAc,EAAE,SAAS,cAAc,IAAI,EAAE;AAAA;AAC9D,sBAAY,EAAE,SAAS,cAAc,KAAK,CAAC;AAAA,MAClD;AAAA,IACF;AAAA,IACA,CAAC,aAAa,eAAe,OAAO,SAAS;AAAA,EAC/C;AAEA,aAAO;AAAA,IACL,OAAO,EAAE,gBAAgB,cAAc,cAAc;AAAA,IACrD,CAAC,cAAc,eAAe,cAAc;AAAA,EAC9C;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -33,8 +33,7 @@ var import_d3 = require("d3");
|
|
|
33
33
|
var import_helpers = require("../helpers");
|
|
34
34
|
var import_colorPallet = require("../helpers/colorPallet");
|
|
35
35
|
const useScales = ({ props, innerHeight, innerWidth, stackedData, currentData, containerRatio }) => {
|
|
36
|
-
const { series, xAxis, yAxis, y2Axis, groups: stackedSeries } = props;
|
|
37
|
-
const xScroll = xAxis.advanced?.pointSpacing?.value > 1;
|
|
36
|
+
const { series, xAxis, yAxis, y2Axis, groups: stackedSeries, xScroll } = props;
|
|
38
37
|
const yScroll = yAxis.advanced?.pointSpacing?.value > 1;
|
|
39
38
|
const rangeToWidth = innerWidth * (xScroll ? containerRatio : 1);
|
|
40
39
|
const rangeToHeight = innerHeight * (yScroll ? containerRatio : 1);
|