@elliemae/ds-dataviz 3.36.0-next.0 → 3.36.0-next.1
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/SingleStackedBar/SingleStackedBar.js +2 -4
- package/dist/cjs/graphs/Chart/SingleStackedBar/SingleStackedBar.js.map +1 -1
- package/dist/cjs/graphs/Chart/SingleStackedBar/index.js +0 -1
- package/dist/cjs/graphs/Chart/SingleStackedBar/index.js.map +1 -1
- package/dist/cjs/graphs/Chart/SingleStackedBar/styles.js.map +1 -1
- package/dist/cjs/graphs/Chart/config/useChart.js.map +1 -1
- package/dist/cjs/graphs/Chart/config/useGetters.js +15 -30
- package/dist/cjs/graphs/Chart/config/useGetters.js.map +1 -1
- package/dist/cjs/graphs/Chart/config/useKeyboardNavigation.js +17 -34
- package/dist/cjs/graphs/Chart/config/useKeyboardNavigation.js.map +1 -1
- package/dist/cjs/graphs/Chart/config/useScales.js +11 -22
- package/dist/cjs/graphs/Chart/config/useScales.js.map +1 -1
- package/dist/cjs/graphs/Chart/config/useValidateProps.js.map +1 -1
- package/dist/cjs/graphs/Chart/helpers/index.js +5 -10
- package/dist/cjs/graphs/Chart/helpers/index.js.map +1 -1
- package/dist/cjs/graphs/Chart/helpers/useUniqueData.js +3 -6
- package/dist/cjs/graphs/Chart/helpers/useUniqueData.js.map +1 -1
- package/dist/cjs/graphs/Chart/helpers/useVirtualizedSeries.js +2 -4
- package/dist/cjs/graphs/Chart/helpers/useVirtualizedSeries.js.map +1 -1
- package/dist/cjs/graphs/Chart/parts/A11yRegion.js +1 -2
- package/dist/cjs/graphs/Chart/parts/A11yRegion.js.map +1 -1
- package/dist/cjs/graphs/Chart/parts/Axis/Axis.js +1 -2
- package/dist/cjs/graphs/Chart/parts/Axis/Axis.js.map +1 -1
- package/dist/cjs/graphs/Chart/parts/Axis/AxisBottom.js +6 -12
- package/dist/cjs/graphs/Chart/parts/Axis/AxisBottom.js.map +1 -1
- package/dist/cjs/graphs/Chart/parts/Axis/AxisLeft.js +5 -10
- package/dist/cjs/graphs/Chart/parts/Axis/AxisLeft.js.map +1 -1
- package/dist/cjs/graphs/Chart/parts/Axis/AxisRight.js +5 -10
- package/dist/cjs/graphs/Chart/parts/Axis/AxisRight.js.map +1 -1
- package/dist/cjs/graphs/Chart/parts/Axis/Tick.js.map +1 -1
- package/dist/cjs/graphs/Chart/parts/ChartContainer.js +6 -12
- package/dist/cjs/graphs/Chart/parts/ChartContainer.js.map +1 -1
- package/dist/cjs/graphs/Chart/parts/ClipPaths.js.map +1 -1
- package/dist/cjs/graphs/Chart/parts/Labels/Label.js.map +1 -1
- package/dist/cjs/graphs/Chart/parts/Legend/BottomLegend.js +1 -2
- package/dist/cjs/graphs/Chart/parts/Legend/BottomLegend.js.map +1 -1
- package/dist/cjs/graphs/Chart/parts/Legend/LeftLegend.js.map +1 -1
- package/dist/cjs/graphs/Chart/parts/Legend/Legend.js +4 -8
- package/dist/cjs/graphs/Chart/parts/Legend/Legend.js.map +1 -1
- package/dist/cjs/graphs/Chart/parts/Legend/LegendItem.js +3 -6
- package/dist/cjs/graphs/Chart/parts/Legend/LegendItem.js.map +1 -1
- package/dist/cjs/graphs/Chart/parts/Legend/RightLegend.js.map +1 -1
- package/dist/cjs/graphs/Chart/parts/Legend/TopLegend.js.map +1 -1
- package/dist/cjs/graphs/Chart/parts/Scrapper/Scrapper.js +1 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/Scrapper.js.map +1 -1
- package/dist/cjs/graphs/Chart/parts/Scrapper/ScrapperLine.js +1 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/ScrapperLine.js.map +1 -1
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js +1 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js.map +1 -1
- package/dist/cjs/graphs/Chart/parts/Scroller/BlurMask.js +1 -2
- package/dist/cjs/graphs/Chart/parts/Scroller/BlurMask.js.map +1 -1
- package/dist/cjs/graphs/Chart/parts/Scroller/Controllers.js +2 -4
- package/dist/cjs/graphs/Chart/parts/Scroller/Controllers.js.map +1 -1
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarX.js.map +1 -1
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarY.js.map +1 -1
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerX.js +7 -14
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerX.js.map +1 -1
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerY.js +2 -4
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerY.js.map +1 -1
- package/dist/cjs/graphs/Chart/parts/TrendHighlight.js +1 -2
- package/dist/cjs/graphs/Chart/parts/TrendHighlight.js.map +1 -1
- package/dist/cjs/graphs/Chart/scales/index.js +13 -26
- package/dist/cjs/graphs/Chart/scales/index.js.map +1 -1
- package/dist/cjs/graphs/Chart/series/Area.js.map +1 -1
- package/dist/cjs/graphs/Chart/series/Bars.js.map +1 -1
- package/dist/cjs/graphs/Chart/series/HorizontalBars.js.map +1 -1
- package/dist/cjs/graphs/Chart/series/HorizontalStackedBars.js.map +1 -1
- package/dist/cjs/graphs/Chart/series/Line.js +1 -2
- package/dist/cjs/graphs/Chart/series/Line.js.map +1 -1
- package/dist/cjs/graphs/Chart/series/Point.js +2 -4
- package/dist/cjs/graphs/Chart/series/Point.js.map +1 -1
- package/dist/cjs/graphs/Chart/series/Points.js.map +1 -1
- package/dist/cjs/graphs/Chart/series/Rect.js +5 -10
- package/dist/cjs/graphs/Chart/series/Rect.js.map +1 -1
- package/dist/cjs/graphs/Chart/series/StackedBar.js.map +1 -1
- package/dist/cjs/graphs/Chart/styles.js.map +1 -1
- package/dist/esm/graphs/Chart/SingleStackedBar/SingleStackedBar.js +2 -4
- package/dist/esm/graphs/Chart/SingleStackedBar/SingleStackedBar.js.map +1 -1
- package/dist/esm/graphs/Chart/SingleStackedBar/index.js +0 -1
- package/dist/esm/graphs/Chart/SingleStackedBar/index.js.map +1 -1
- package/dist/esm/graphs/Chart/SingleStackedBar/styles.js.map +1 -1
- package/dist/esm/graphs/Chart/config/useChart.js.map +1 -1
- package/dist/esm/graphs/Chart/config/useGetters.js +15 -30
- package/dist/esm/graphs/Chart/config/useGetters.js.map +1 -1
- package/dist/esm/graphs/Chart/config/useKeyboardNavigation.js +17 -34
- package/dist/esm/graphs/Chart/config/useKeyboardNavigation.js.map +1 -1
- package/dist/esm/graphs/Chart/config/useScales.js +11 -22
- package/dist/esm/graphs/Chart/config/useScales.js.map +1 -1
- package/dist/esm/graphs/Chart/config/useValidateProps.js.map +1 -1
- package/dist/esm/graphs/Chart/helpers/index.js +5 -10
- package/dist/esm/graphs/Chart/helpers/index.js.map +1 -1
- package/dist/esm/graphs/Chart/helpers/useUniqueData.js +3 -6
- package/dist/esm/graphs/Chart/helpers/useUniqueData.js.map +1 -1
- package/dist/esm/graphs/Chart/helpers/useVirtualizedSeries.js +2 -4
- package/dist/esm/graphs/Chart/helpers/useVirtualizedSeries.js.map +1 -1
- package/dist/esm/graphs/Chart/parts/A11yRegion.js +1 -2
- package/dist/esm/graphs/Chart/parts/A11yRegion.js.map +1 -1
- package/dist/esm/graphs/Chart/parts/Axis/Axis.js +1 -2
- package/dist/esm/graphs/Chart/parts/Axis/Axis.js.map +1 -1
- package/dist/esm/graphs/Chart/parts/Axis/AxisBottom.js +6 -12
- package/dist/esm/graphs/Chart/parts/Axis/AxisBottom.js.map +1 -1
- package/dist/esm/graphs/Chart/parts/Axis/AxisLeft.js +5 -10
- package/dist/esm/graphs/Chart/parts/Axis/AxisLeft.js.map +1 -1
- package/dist/esm/graphs/Chart/parts/Axis/AxisRight.js +5 -10
- package/dist/esm/graphs/Chart/parts/Axis/AxisRight.js.map +1 -1
- package/dist/esm/graphs/Chart/parts/Axis/Tick.js.map +1 -1
- package/dist/esm/graphs/Chart/parts/ChartContainer.js +6 -12
- package/dist/esm/graphs/Chart/parts/ChartContainer.js.map +1 -1
- package/dist/esm/graphs/Chart/parts/ClipPaths.js.map +1 -1
- package/dist/esm/graphs/Chart/parts/Labels/Label.js.map +1 -1
- package/dist/esm/graphs/Chart/parts/Legend/BottomLegend.js +1 -2
- package/dist/esm/graphs/Chart/parts/Legend/BottomLegend.js.map +1 -1
- package/dist/esm/graphs/Chart/parts/Legend/LeftLegend.js.map +1 -1
- package/dist/esm/graphs/Chart/parts/Legend/Legend.js +4 -8
- package/dist/esm/graphs/Chart/parts/Legend/Legend.js.map +1 -1
- package/dist/esm/graphs/Chart/parts/Legend/LegendItem.js +3 -6
- package/dist/esm/graphs/Chart/parts/Legend/LegendItem.js.map +1 -1
- package/dist/esm/graphs/Chart/parts/Legend/RightLegend.js.map +1 -1
- package/dist/esm/graphs/Chart/parts/Legend/TopLegend.js.map +1 -1
- package/dist/esm/graphs/Chart/parts/Scrapper/Scrapper.js +1 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/Scrapper.js.map +1 -1
- package/dist/esm/graphs/Chart/parts/Scrapper/ScrapperLine.js +1 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/ScrapperLine.js.map +1 -1
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js +1 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js.map +1 -1
- package/dist/esm/graphs/Chart/parts/Scroller/BlurMask.js +1 -2
- package/dist/esm/graphs/Chart/parts/Scroller/BlurMask.js.map +1 -1
- package/dist/esm/graphs/Chart/parts/Scroller/Controllers.js +2 -4
- package/dist/esm/graphs/Chart/parts/Scroller/Controllers.js.map +1 -1
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarX.js.map +1 -1
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarY.js.map +1 -1
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerX.js +7 -14
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerX.js.map +1 -1
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerY.js +2 -4
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerY.js.map +1 -1
- package/dist/esm/graphs/Chart/parts/TrendHighlight.js +1 -2
- package/dist/esm/graphs/Chart/parts/TrendHighlight.js.map +1 -1
- package/dist/esm/graphs/Chart/scales/index.js +13 -26
- package/dist/esm/graphs/Chart/scales/index.js.map +1 -1
- package/dist/esm/graphs/Chart/series/Area.js.map +1 -1
- package/dist/esm/graphs/Chart/series/Bars.js.map +1 -1
- package/dist/esm/graphs/Chart/series/HorizontalBars.js.map +1 -1
- package/dist/esm/graphs/Chart/series/HorizontalStackedBars.js.map +1 -1
- package/dist/esm/graphs/Chart/series/Line.js +1 -2
- package/dist/esm/graphs/Chart/series/Line.js.map +1 -1
- package/dist/esm/graphs/Chart/series/Point.js +2 -4
- package/dist/esm/graphs/Chart/series/Point.js.map +1 -1
- package/dist/esm/graphs/Chart/series/Points.js.map +1 -1
- package/dist/esm/graphs/Chart/series/Rect.js +5 -10
- package/dist/esm/graphs/Chart/series/Rect.js.map +1 -1
- package/dist/esm/graphs/Chart/series/StackedBar.js.map +1 -1
- package/dist/esm/graphs/Chart/styles.js.map +1 -1
- package/package.json +7 -7
|
@@ -101,10 +101,8 @@ const DSSingleStackedBar = (props) => {
|
|
|
101
101
|
const barNames = (0, import_react.useMemo)(() => data.map((datum) => datum.name), [data]);
|
|
102
102
|
const getBorderRadius = (0, import_react.useCallback)(
|
|
103
103
|
(index) => {
|
|
104
|
-
if (index === 0)
|
|
105
|
-
|
|
106
|
-
if (index === data.length - 1)
|
|
107
|
-
return "0 50px 50px 0";
|
|
104
|
+
if (index === 0) return "50px 0 0 50px";
|
|
105
|
+
if (index === data.length - 1) return "0 50px 50px 0";
|
|
108
106
|
return void 0;
|
|
109
107
|
},
|
|
110
108
|
[data.length]
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/graphs/Chart/SingleStackedBar/SingleStackedBar.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["/* eslint-disable max-lines */\nimport React, { useCallback, useMemo, useState, type WeakValidationMap } from 'react';\nimport type { DSGridT } from '@elliemae/ds-grid';\nimport { Grid } from '@elliemae/ds-grid';\nimport {\n useGetGlobalAttributes,\n useGetXstyledProps,\n useMemoMergePropsWithDefault,\n useValidateTypescriptPropTypes,\n describe,\n} from '@elliemae/ds-props-helpers';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport { mergeRefs } from '@elliemae/ds-utilities';\nimport { COLOR_PALLET } from '../../../index.js';\nimport { type DSSingleStackedBarT, defaultProps, DSSingleStackedBarPropTypes } from './react-desc-prop-types.js';\nimport { StyledBar, StyledMouseOverDetectionBox, StyledTooltipContainer, Wrapper } from './styles.js';\nimport { DSSingleStackedBarName } from './exported-related/index.js';\nconst Bar = React.memo((props: DSSingleStackedBarT.BarT) => {\n const [referenceElement, setReferenceElement] = useState<HTMLDivElement | null>(null);\n const [isHover, setIsHover] = useState(false);\n const { height, TooltipRenderer, datum, tabIndex, isFocused, borderRadius, bg } = props;\n const handleRefCallback = useCallback(\n (_ref: HTMLDivElement | null) => {\n if (isFocused) {\n _ref?.focus();\n }\n },\n [isFocused],\n );\n\n const handleMouseEnter = useCallback(() => {\n setIsHover(true);\n }, []);\n\n const handleMouseLeave = useCallback(() => {\n setIsHover(false);\n }, []);\n return (\n <div>\n {(isFocused || isHover) && TooltipRenderer ? (\n <DSPopperJS referenceElement={referenceElement} showPopover>\n <StyledMouseOverDetectionBox />\n <StyledTooltipContainer>\n <TooltipRenderer datum={datum} />\n </StyledTooltipContainer>\n </DSPopperJS>\n ) : null}\n <StyledBar\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n bg={bg}\n height={height}\n borderRadius={borderRadius}\n innerRef={mergeRefs(handleRefCallback, setReferenceElement)}\n tabIndex={tabIndex}\n role=\"img\"\n // until uziel work is merged we keep this default value\n aria-label={`${datum.name} value: ${datum.data}`}\n />\n </div>\n );\n});\n\nconst DSSingleStackedBar: React.ComponentType<DSSingleStackedBarT.Props> = (props) => {\n const propsWithDefaults = useMemoMergePropsWithDefault<DSSingleStackedBarT.InternalProps>(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefaults, DSSingleStackedBarPropTypes, 'DSSingleStackedBar');\n\n const globalAttributes = useGetGlobalAttributes<DSSingleStackedBarT.InternalProps, HTMLDivElement, DSGridT.Props>(\n propsWithDefaults,\n );\n\n const xstyledProps = useGetXstyledProps(propsWithDefaults);\n\n const { data, LegendRenderer, gutter, height } = propsWithDefaults;\n const [keyBarFocused, setKeyBarFocused] = useState<number>(0);\n const [isChartFocused, setIsChartFocused] = useState(false);\n\n const total = useMemo(() => data.map((datum) => datum.data).reduce((acc, curr) => acc + curr, 0), [data]);\n const cols = useMemo(() => data.map((datum) => `${Math.ceil(datum.data * 100) / total}%`), [data, total]);\n const rows = useMemo(\n () => (LegendRenderer !== undefined ? [`${height}px`, 'auto'] : [`${height}px`]),\n [LegendRenderer, height],\n );\n const barNames = useMemo(() => data.map((datum) => datum.name), [data]);\n const getBorderRadius = useCallback(\n (index: number) => {\n if (index === 0) return '50px 0 0 50px';\n if (index === data.length - 1) return '0 50px 50px 0';\n return undefined;\n },\n [data.length],\n );\n\n const handleOnKeyDown: React.KeyboardEventHandler = useCallback(\n (e) => {\n if (e.code === 'ArrowRight') {\n if (barNames[keyBarFocused + 1]) {\n setKeyBarFocused(keyBarFocused + 1);\n } else {\n setKeyBarFocused(0);\n }\n }\n if (e.code === 'ArrowLeft') {\n if (barNames[keyBarFocused - 1]) {\n setKeyBarFocused(keyBarFocused - 1);\n } else {\n setKeyBarFocused(barNames.length - 1);\n }\n }\n },\n [keyBarFocused, barNames],\n );\n\n return (\n <Wrapper\n cols={cols}\n gutter={gutter}\n role=\"region\"\n onKeyDown={handleOnKeyDown}\n tabIndex={-1}\n onFocus={() => setIsChartFocused(true)}\n onBlur={(e) => e.currentTarget !== e.target && setIsChartFocused(false)}\n {...xstyledProps}\n {...globalAttributes}\n >\n {data.map((datum, i) => (\n <Grid rows={rows}>\n <Bar\n key={datum.name}\n datum={datum}\n isFocused={barNames[keyBarFocused] === datum.name && isChartFocused}\n borderRadius={getBorderRadius(i)}\n bg={COLOR_PALLET[datum.color as keyof typeof COLOR_PALLET] ?? datum.color}\n tabIndex={i === keyBarFocused ? 0 : -1}\n {...props}\n />\n {LegendRenderer !== undefined ? <LegendRenderer key={`${datum.name}-legend`} datum={datum} /> : null}\n </Grid>\n ))}\n </Wrapper>\n );\n};\n\nDSSingleStackedBar.displayName = DSSingleStackedBarName;\nconst DSSingleStackedBarWithSchema = describe(DSSingleStackedBar);\nDSSingleStackedBarWithSchema.propTypes =\n DSSingleStackedBarPropTypes as unknown as WeakValidationMap<DSSingleStackedBarT.Props>;\n\nexport { DSSingleStackedBarWithSchema, DSSingleStackedBar };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADwCf;AAvCR,mBAA8E;AAE9E,qBAAqB;AACrB,8BAMO;AACP,yBAA2B;AAC3B,0BAA0B;AAC1B,eAA6B;AAC7B,mCAAoF;AACpF,oBAAwF;AACxF,8BAAuC;AACvC,MAAM,MAAM,aAAAA,QAAM,KAAK,CAAC,UAAoC;AAC1D,QAAM,CAAC,kBAAkB,mBAAmB,QAAI,uBAAgC,IAAI;AACpF,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAS,KAAK;AAC5C,QAAM,EAAE,QAAQ,iBAAiB,OAAO,UAAU,WAAW,cAAc,GAAG,IAAI;AAClF,QAAM,wBAAoB;AAAA,IACxB,CAAC,SAAgC;AAC/B,UAAI,WAAW;AACb,cAAM,MAAM;AAAA,MACd;AAAA,IACF;AAAA,IACA,CAAC,SAAS;AAAA,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a,MAAM,KAAkC,KAAK,MAAM;AAAA,YACpE,UAAU,MAAM,gBAAgB,IAAI;AAAA,YACnC,GAAG;AAAA;AAAA,UANC,MAAM;AAAA,QAOb;AAAA,QACC,mBAAmB,SAAY,4CAAC,kBAA4C,SAAxB,GAAG,MAAM,IAAI,SAAyB,IAAK;AAAA,SAClG,CACD;AAAA;AAAA,EACH;AAEJ;AAEA,mBAAmB,cAAc;AACjC,MAAM,mCAA+B,kCAAS,kBAAkB;AAChE,6BAA6B,YAC3B;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -27,6 +27,5 @@ var SingleStackedBar_exports = {};
|
|
|
27
27
|
module.exports = __toCommonJS(SingleStackedBar_exports);
|
|
28
28
|
var React = __toESM(require("react"));
|
|
29
29
|
__reExport(SingleStackedBar_exports, require("../SingleStackedBar/SingleStackedBar.js"), module.exports);
|
|
30
|
-
var import_react_desc_prop_types = require("../SingleStackedBar/react-desc-prop-types.js");
|
|
31
30
|
__reExport(SingleStackedBar_exports, require("../SingleStackedBar/exported-related/index.js"), module.exports);
|
|
32
31
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/graphs/Chart/SingleStackedBar/index.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["export * from '../SingleStackedBar/SingleStackedBar.js';\nexport { type DSSingleStackedBarT } from '../SingleStackedBar/react-desc-prop-types.js';\nexport * from '../SingleStackedBar/exported-related/index.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;ADAvB,qCAAc,oDAAd;
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;ADAvB,qCAAc,oDAAd;AAEA,qCAAc,0DAFd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/graphs/Chart/SingleStackedBar/styles.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import { styled, css } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSSingleStackedBarSlots, DSSingleStackedBarName } from './exported-related/index.js';\nconst focusRing = css`\n outline: 2px solid brand-700;\n outline-offset: 2px;\n`;\nexport const StyledBar = styled(Grid)`\n &:focus,\n :focus-visible {\n ${focusRing}\n }\n`;\n\nexport const Wrapper = styled(Grid, { name: DSSingleStackedBarName, slot: DSSingleStackedBarSlots.WRAPPER })``;\n\nexport const StyledTooltipContainer = styled.div`\n max-width: 350px;\n background-color: white;\n`;\n\nexport const StyledMouseOverDetectionBox = styled.div`\n position: absolute;\n top: -15px;\n right: -15px;\n width: calc(100% + 30px);\n height: calc(100% + 30px);\n z-index: -1;\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA4B;AAC5B,qBAAqB;AACrB,8BAAgE;AAChE,MAAM,YAAY;AAAA;AAAA;AAAA;AAIX,MAAM,gBAAY,yBAAO,mBAAI;AAAA;AAAA;AAAA,MAG9B;AAAA;AAAA;
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA4B;AAC5B,qBAAqB;AACrB,8BAAgE;AAChE,MAAM,YAAY;AAAA;AAAA;AAAA;AAIX,MAAM,gBAAY,yBAAO,mBAAI;AAAA;AAAA;AAAA,MAG9B,SAAS;AAAA;AAAA;AAIR,MAAM,cAAU,yBAAO,qBAAM,EAAE,MAAM,gDAAwB,MAAM,gDAAwB,QAAQ,CAAC;AAEpG,MAAM,yBAAyB,wBAAO;AAAA;AAAA;AAAA;AAKtC,MAAM,8BAA8B,wBAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/graphs/Chart/config/useChart.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
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 { uid } from 'uid';\nimport { debounce } from 'lodash';\nimport type { DSChartT } from '../react-desc-prop-types.js';\nimport { defaultProps } from '../react-desc-prop-types.js';\nimport { useScales } from './useScales.js';\nimport { stackData } from '../helpers/index.js';\nimport { useInternalMargins } from './useInternalMargins.js';\nimport { useGetters } from './useGetters.js';\nimport ResizeObserver from 'resize-observer-polyfill';\nimport { useValidateProps } from './useValidateProps.js';\nimport { COLOR_PALLET } from '../helpers/colorPallet.js';\ntype ResizeObserverConstructorEntries = Parameters<ConstructorParameters<typeof ResizeObserver>[0]>[0];\n\nconst useResizeObserver = (ref: HTMLElement | null | undefined) => {\n const [dimensions, setDimensions] = useState<number>(0);\n\n useEffect(() => {\n if (ref) {\n const observeTarget = ref;\n const resizeObserver = new ResizeObserver(\n debounce((entries: ResizeObserverConstructorEntries) => {\n entries.forEach((entry) => {\n setDimensions(Math.ceil(entry.contentRect.width));\n });\n }, 200),\n );\n resizeObserver.observe(observeTarget);\n\n return () => {\n resizeObserver.unobserve(observeTarget);\n };\n }\n }, [ref]);\n return dimensions;\n};\n\nexport const useChart = (props: DSChartT.Props) => {\n useValidateProps(props);\n\n // const propsWithDefaults = useMemoMergePropsWithDefault(props, defaultProps);\n const { series, yAxis, xAxis, width: userWidth, height: userHeight, groups: groupsStacked } = props;\n const userRatio = useMemo(\n () => props?.xAxis.advanced?.pointSpacing?.value ?? props?.yAxis.advanced?.pointSpacing?.value ?? 1,\n [props?.xAxis.advanced?.pointSpacing?.value, props?.yAxis.advanced?.pointSpacing?.value],\n );\n const originalSeries = useMemo(() => {\n if (series.length === 0) {\n return defaultProps.series;\n }\n return series;\n }, [series]);\n const [containerRef, setContainerRef] = useState<HTMLDivElement | null>(null);\n\n const dimensionWidth = useResizeObserver(containerRef);\n\n const width = useMemo(() => userWidth ?? dimensionWidth ?? 0, [dimensionWidth, userWidth]);\n\n const height = useMemo(() => userHeight ?? 500, [userHeight]);\n\n const [isGrabbed, setIsGrabbed] = useState(false);\n const [startPosition, setStartPosition] = useState(0);\n\n // zoom\n\n const [isZooming, setIsZooming] = useState(false);\n const [zoomStartingPosition, setZoomStartingPosition] = useState(0);\n const [movingPosition, setMovingPosition] = useState(0);\n\n //\n\n const [activePoint, setActivePoint] = useState<DSChartT.InternalDatum | null>(null);\n const [activeSerie, setActiveSerie] = useState('');\n const [scrapperPosY, setScrapperPosY] = useState(-1);\n const [scrapperPosX, setScrapperPosX] = useState(-1);\n const [xScrollbarPosition, setXScrollbarPosition] = useState(0);\n const [isScrollbarVisible, setIsScrollbarVisible] = useState(false);\n const [containerRatio, setContainerRatio] = useState(userRatio);\n\n const lastScrollbarPosition = 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 // we reset the scrollbar position when the chart resize\n useEffect(() => {\n lastScrollbarPosition.current = 0;\n setXScrollbarPosition(0);\n }, [dimensionWidth]);\n\n useEffect(() => {\n setContainerRatio(userRatio);\n }, [userRatio]);\n\n const {\n toolbarHeight,\n axisBottomHeight,\n axisRightWidth,\n bottomLabelHeight,\n internalMargin,\n leftLegendWidth,\n rightLabelWidth,\n leftLabelHeight,\n rightLegendHeight,\n bottomLegendWidth,\n leftLabelWidth,\n axisLeftWidth,\n topLegendHeight,\n leftLegendHeight,\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 defaultScale = useMemo(() => {\n if (yAxis.type === 'band') {\n return 'x';\n }\n\n if ([undefined, 'band'].includes(xAxis.type)) {\n return 'y';\n }\n\n return 'y';\n }, [xAxis.type, yAxis.type]);\n\n const [currentDataWithNullValues, currentData] = useMemo(() => {\n const baseData = originalSeries\n .filter((serie) => !hiddenSeries.includes(serie.name))\n .map((d, i) => ({\n ...d,\n // we set a default on the scale if the user do not pass it\n scale: d.scale || defaultScale,\n key: `${d.name}-${i}`,\n data: d.data.map((value, index) => ({\n key: `${d.name}-${i}-${index}`,\n value,\n position: index,\n serie: d.name,\n scale: d.scale,\n color: COLOR_PALLET[d.color as keyof typeof COLOR_PALLET] ?? d.color,\n })),\n })) as DSChartT.InternalData;\n\n const currentDataWithoutNulls = baseData.map((data) => ({\n ...data,\n data: data.data.filter((datum) => datum.value !== null && datum.value !== undefined),\n }));\n\n return [baseData, currentDataWithoutNulls];\n }, [defaultScale, hiddenSeries, originalSeries]);\n\n const isHorizontal = useMemo(() => yAxis?.type === 'band', [yAxis]);\n\n const { stackedData, scalesStackedDataMap } = useMemo(\n () => stackData(groupsStacked, originalSeries, hiddenSeries, isHorizontal),\n [groupsStacked, originalSeries, hiddenSeries, isHorizontal],\n );\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 originalSeries,\n innerHeight,\n innerWidth,\n groups,\n stackedData,\n scalesStackedDataMap,\n currentData,\n containerRatio,\n });\n\n const {\n getXValue,\n getY2ScaleValue,\n getYValue,\n getXScaleValue,\n getYScaleValue,\n getYValueFormatted,\n getXValueFormatted,\n } = useGetters({\n xAxis,\n yAxis,\n isHorizontal,\n xScale,\n yScale,\n y2Scale,\n });\n const chartId = useMemo(() => uid(6), []);\n\n return useMemo(\n () => ({\n props,\n originalSeries,\n isZooming,\n setIsZooming,\n zoomStartingPosition,\n setZoomStartingPosition,\n setMovingPosition,\n movingPosition,\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 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 lastScrollbarPosition,\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 getY2ScaleValue,\n getYValueFormatted,\n getXValueFormatted,\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 leftLabelHeight,\n rightLegendHeight,\n bottomLegendWidth,\n bottomLegend,\n leftLabelWidth,\n axisLeftWidth,\n topLegendHeight,\n leftLegendHeight,\n currentDataWithNullValues,\n }),\n [\n props,\n originalSeries,\n isZooming,\n zoomStartingPosition,\n movingPosition,\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 getY2ScaleValue,\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 getYValueFormatted,\n getXValueFormatted,\n bottomLabelHeight,\n rightLabelWidth,\n axisRightWidth,\n getXValue,\n getYValue,\n isHorizontal,\n leftLabel,\n chartId,\n hiddenSeries,\n height,\n width,\n toolbarHeight,\n leftLabelHeight,\n rightLegendHeight,\n bottomLegendWidth,\n bottomLegend,\n leftLabelWidth,\n axisLeftWidth,\n topLegendHeight,\n leftLegendHeight,\n currentDataWithNullValues,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;A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A;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,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": ["ResizeObserver"]
|
|
7
7
|
}
|
|
@@ -48,14 +48,12 @@ function isValueT(value) {
|
|
|
48
48
|
const useGetters = ({ xAxis, isHorizontal, yAxis, xScale, yScale, y2Scale }) => {
|
|
49
49
|
const getXValue = (0, import_react.useCallback)(
|
|
50
50
|
(datum) => {
|
|
51
|
-
if (!datum)
|
|
52
|
-
return null;
|
|
51
|
+
if (!datum) return null;
|
|
53
52
|
if (!isHorizontal) {
|
|
54
53
|
if (xAxis?.cols?.[datum.position]) {
|
|
55
54
|
return xAxis?.cols?.[datum.position];
|
|
56
55
|
}
|
|
57
|
-
if (typeof datum.value === "object")
|
|
58
|
-
return datum.value?.x;
|
|
56
|
+
if (typeof datum.value === "object") return datum.value?.x;
|
|
59
57
|
return datum.position.toString();
|
|
60
58
|
}
|
|
61
59
|
if (typeof datum.value === "number") {
|
|
@@ -67,8 +65,7 @@ const useGetters = ({ xAxis, isHorizontal, yAxis, xScale, yScale, y2Scale }) =>
|
|
|
67
65
|
);
|
|
68
66
|
const getYValue = (0, import_react.useCallback)(
|
|
69
67
|
(datum) => {
|
|
70
|
-
if (!datum)
|
|
71
|
-
return null;
|
|
68
|
+
if (!datum) return null;
|
|
72
69
|
if (!isHorizontal) {
|
|
73
70
|
if (typeof datum.value === "number") {
|
|
74
71
|
return datum.value;
|
|
@@ -78,8 +75,7 @@ const useGetters = ({ xAxis, isHorizontal, yAxis, xScale, yScale, y2Scale }) =>
|
|
|
78
75
|
if (yAxis?.cols?.[datum.position]) {
|
|
79
76
|
return yAxis?.cols?.[datum.position];
|
|
80
77
|
}
|
|
81
|
-
if (typeof datum.value === "object")
|
|
82
|
-
return datum.value?.y;
|
|
78
|
+
if (typeof datum.value === "object") return datum.value?.y;
|
|
83
79
|
return datum.position.toString();
|
|
84
80
|
},
|
|
85
81
|
[isHorizontal, yAxis?.cols]
|
|
@@ -87,18 +83,15 @@ const useGetters = ({ xAxis, isHorizontal, yAxis, xScale, yScale, y2Scale }) =>
|
|
|
87
83
|
const getXScaleValue = (0, import_react.useCallback)(
|
|
88
84
|
(datum) => {
|
|
89
85
|
if (isLinear(xScale)) {
|
|
90
|
-
if (isValueT(datum))
|
|
91
|
-
return xScale?.get(datum);
|
|
86
|
+
if (isValueT(datum)) return xScale?.get(datum);
|
|
92
87
|
return xScale?.get(getXValue(datum));
|
|
93
88
|
}
|
|
94
89
|
if (isBand(xScale)) {
|
|
95
|
-
if (isValueT(datum))
|
|
96
|
-
return xScale?.get(datum) ?? 0;
|
|
90
|
+
if (isValueT(datum)) return xScale?.get(datum) ?? 0;
|
|
97
91
|
return xScale?.get(getXValue(datum)) ?? 0;
|
|
98
92
|
}
|
|
99
93
|
if (isTime(xScale)) {
|
|
100
|
-
if (isValueT(datum))
|
|
101
|
-
return xScale?.get(datum);
|
|
94
|
+
if (isValueT(datum)) return xScale?.get(datum);
|
|
102
95
|
return xScale?.get(new Date(getXValue(datum)));
|
|
103
96
|
}
|
|
104
97
|
return 0;
|
|
@@ -108,13 +101,11 @@ const useGetters = ({ xAxis, isHorizontal, yAxis, xScale, yScale, y2Scale }) =>
|
|
|
108
101
|
const getYScaleValue = (0, import_react.useCallback)(
|
|
109
102
|
(datum) => {
|
|
110
103
|
if (isLinear(yScale)) {
|
|
111
|
-
if (isValueT(datum))
|
|
112
|
-
return yScale?.get(datum);
|
|
104
|
+
if (isValueT(datum)) return yScale?.get(datum);
|
|
113
105
|
return yScale.get(getYValue(datum));
|
|
114
106
|
}
|
|
115
107
|
if (isBand(yScale)) {
|
|
116
|
-
if (isValueT(datum))
|
|
117
|
-
return yScale?.get(datum) ?? 0;
|
|
108
|
+
if (isValueT(datum)) return yScale?.get(datum) ?? 0;
|
|
118
109
|
return yScale?.get(getYValue(datum)) ?? 0;
|
|
119
110
|
}
|
|
120
111
|
return 0;
|
|
@@ -124,13 +115,11 @@ const useGetters = ({ xAxis, isHorizontal, yAxis, xScale, yScale, y2Scale }) =>
|
|
|
124
115
|
const getY2ScaleValue = (0, import_react.useCallback)(
|
|
125
116
|
(datum) => {
|
|
126
117
|
if (isLinear(y2Scale)) {
|
|
127
|
-
if (isValueT(datum))
|
|
128
|
-
return y2Scale?.get(datum);
|
|
118
|
+
if (isValueT(datum)) return y2Scale?.get(datum);
|
|
129
119
|
return y2Scale.get(getYValue(datum));
|
|
130
120
|
}
|
|
131
121
|
if (isBand(y2Scale)) {
|
|
132
|
-
if (isValueT(datum))
|
|
133
|
-
return y2Scale?.get(datum) ?? 0;
|
|
122
|
+
if (isValueT(datum)) return y2Scale?.get(datum) ?? 0;
|
|
134
123
|
return y2Scale?.get(getYValue(datum)) ?? 0;
|
|
135
124
|
}
|
|
136
125
|
return 0;
|
|
@@ -139,22 +128,18 @@ const useGetters = ({ xAxis, isHorizontal, yAxis, xScale, yScale, y2Scale }) =>
|
|
|
139
128
|
);
|
|
140
129
|
const getYValueFormatted = (0, import_react.useCallback)(
|
|
141
130
|
(datum) => {
|
|
142
|
-
if (!datum)
|
|
143
|
-
return null;
|
|
131
|
+
if (!datum) return null;
|
|
144
132
|
const value = getYValue(datum);
|
|
145
|
-
if (typeof yAxis.tick?.tickFormat === "function")
|
|
146
|
-
return yAxis.tick.tickFormat(value);
|
|
133
|
+
if (typeof yAxis.tick?.tickFormat === "function") return yAxis.tick.tickFormat(value);
|
|
147
134
|
return value;
|
|
148
135
|
},
|
|
149
136
|
[getYValue, yAxis.tick]
|
|
150
137
|
);
|
|
151
138
|
const getXValueFormatted = (0, import_react.useCallback)(
|
|
152
139
|
(datum) => {
|
|
153
|
-
if (!datum)
|
|
154
|
-
return null;
|
|
140
|
+
if (!datum) return null;
|
|
155
141
|
const value = getXValue(datum);
|
|
156
|
-
if (typeof xAxis.tick?.tickFormat === "function")
|
|
157
|
-
return xAxis.tick.tickFormat(value);
|
|
142
|
+
if (typeof xAxis.tick?.tickFormat === "function") return xAxis.tick.tickFormat(value);
|
|
158
143
|
return value;
|
|
159
144
|
},
|
|
160
145
|
[getXValue, xAxis.tick]
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/graphs/Chart/config/useGetters.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import { useCallback, useMemo } from 'react';\nimport type { DSChartT } from '../react-desc-prop-types.js';\nimport type { TimeLinearScale, LinearScale, BandScale } from '../scales/index.js';\ninterface UseGettersT {\n xAxis: DSChartT.AxisT;\n yAxis: DSChartT.AxisT;\n isHorizontal: boolean;\n xScale: TimeLinearScale | LinearScale | BandScale | null;\n yScale: TimeLinearScale | LinearScale | BandScale | null;\n y2Scale: TimeLinearScale | LinearScale | BandScale | null;\n}\n\ntype ValueT = number | string | Date;\n\nfunction isLinear(scale: TimeLinearScale | LinearScale | BandScale | null): scale is LinearScale {\n return (scale as LinearScale).type !== 'LINEAR';\n}\n\nfunction isBand(scale: TimeLinearScale | LinearScale | BandScale | null): scale is BandScale {\n return (scale as BandScale).type !== 'BAND';\n}\n\nfunction isTime(scale: TimeLinearScale | LinearScale | BandScale | null): scale is TimeLinearScale {\n return (scale as TimeLinearScale).type !== 'DATETIME';\n}\n\nfunction isValueT(value: DSChartT.InternalDatum | ValueT): value is ValueT {\n return typeof value === 'number' || typeof value === 'string' || value instanceof Date;\n}\n\nexport const useGetters = ({ xAxis, isHorizontal, yAxis, xScale, yScale, y2Scale }: UseGettersT) => {\n const getXValue = useCallback(\n (datum: DSChartT.InternalDatum) => {\n if (!datum) return null;\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 (!datum) return null;\n\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 | ValueT) => {\n if (isLinear(xScale)) {\n if (isValueT(datum)) return xScale?.get(datum as number);\n return xScale?.get(getXValue(datum) as number);\n }\n if (isBand(xScale)) {\n if (isValueT(datum)) return xScale?.get(datum as string) ?? 0;\n return xScale?.get(getXValue(datum) as string) ?? 0;\n }\n if (isTime(xScale)) {\n if (isValueT(datum)) return xScale?.get(datum as Date);\n return xScale?.get(new Date(getXValue(datum) as string));\n }\n return 0;\n },\n [getXValue, xScale],\n );\n\n const getYScaleValue = useCallback(\n (datum: DSChartT.InternalDatum | ValueT) => {\n if (isLinear(yScale)) {\n if (isValueT(datum)) return yScale?.get(datum as number);\n return yScale.get(getYValue(datum) as number);\n }\n if (isBand(yScale)) {\n if (isValueT(datum)) return yScale?.get(datum as string) ?? 0;\n return yScale?.get(getYValue(datum) as string) ?? 0;\n }\n return 0;\n },\n [getYValue, yScale],\n );\n\n const getY2ScaleValue = useCallback(\n (datum: DSChartT.InternalDatum | ValueT) => {\n if (isLinear(y2Scale)) {\n if (isValueT(datum)) return y2Scale?.get(datum as number);\n return y2Scale.get(getYValue(datum) as number);\n }\n if (isBand(y2Scale)) {\n if (isValueT(datum)) return y2Scale?.get(datum as string) ?? 0;\n return y2Scale?.get(getYValue(datum) as string) ?? 0;\n }\n return 0;\n },\n [getYValue, y2Scale],\n );\n\n const getYValueFormatted = useCallback(\n (datum: DSChartT.InternalDatum) => {\n if (!datum) return null;\n\n const value = getYValue(datum);\n if (typeof yAxis.tick?.tickFormat === 'function') return yAxis.tick.tickFormat(value as number);\n return value;\n },\n [getYValue, yAxis.tick],\n );\n\n const getXValueFormatted = useCallback(\n (datum: DSChartT.InternalDatum) => {\n if (!datum) return null;\n\n const value = getXValue(datum);\n if (typeof xAxis.tick?.tickFormat === 'function') return xAxis.tick.tickFormat(value as number);\n return value;\n },\n [getXValue, xAxis.tick],\n );\n\n return useMemo(\n () => ({\n getYValue,\n getY2ScaleValue,\n getXValue,\n getXScaleValue,\n getYScaleValue,\n getYValueFormatted,\n getXValueFormatted,\n }),\n [getYValue, getXValue, getY2ScaleValue, getXScaleValue, getYScaleValue, getYValueFormatted, getXValueFormatted],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;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AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,WAAW,WAAW,iBAAiB,gBAAgB,gBAAgB,oBAAoB,kBAAkB;AAAA,EAChH;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -78,8 +78,7 @@ const useKeyboardNavigation = () => {
|
|
|
78
78
|
);
|
|
79
79
|
const listMap = (0, import_react.useMemo)(
|
|
80
80
|
() => currentSerie?.data.map((d) => {
|
|
81
|
-
if (typeof d.value === "object")
|
|
82
|
-
return JSON.stringify(d.value);
|
|
81
|
+
if (typeof d.value === "object") return JSON.stringify(d.value);
|
|
83
82
|
return d.value?.toString();
|
|
84
83
|
}) ?? [],
|
|
85
84
|
[currentSerie?.data]
|
|
@@ -106,8 +105,7 @@ const useKeyboardNavigation = () => {
|
|
|
106
105
|
setActivePoint(currentSerie?.data[newValue]);
|
|
107
106
|
if (xScroll) {
|
|
108
107
|
const xValue = getXScaleValue(currentSerie?.data[newValue]);
|
|
109
|
-
if (xValue === void 0)
|
|
110
|
-
return;
|
|
108
|
+
if (xValue === void 0) return;
|
|
111
109
|
const barWidth = innerWidth / containerRatio;
|
|
112
110
|
const total = innerWidth * containerRatio;
|
|
113
111
|
if (total <= xValue) {
|
|
@@ -115,16 +113,13 @@ const useKeyboardNavigation = () => {
|
|
|
115
113
|
} else if (xValue > xScrollbarPosition * containerRatio + innerWidth)
|
|
116
114
|
setXScrollbarPosition((prev) => {
|
|
117
115
|
const nextPosition = prev + (xValue / containerRatio - prev);
|
|
118
|
-
if (nextPosition + barWidth > innerWidth)
|
|
119
|
-
return innerWidth - barWidth;
|
|
116
|
+
if (nextPosition + barWidth > innerWidth) return innerWidth - barWidth;
|
|
120
117
|
return nextPosition;
|
|
121
118
|
});
|
|
122
|
-
else if (xValue < xScrollbarPosition * containerRatio)
|
|
123
|
-
setXScrollbarPosition(xValue / containerRatio);
|
|
119
|
+
else if (xValue < xScrollbarPosition * containerRatio) setXScrollbarPosition(xValue / containerRatio);
|
|
124
120
|
} else if (yScroll) {
|
|
125
121
|
const yValue = getYScaleValue(currentSerie?.data[newValue]);
|
|
126
|
-
if (yValue === void 0)
|
|
127
|
-
return;
|
|
122
|
+
if (yValue === void 0) return;
|
|
128
123
|
const barWidth = innerHeight / containerRatio;
|
|
129
124
|
const total = innerHeight * containerRatio;
|
|
130
125
|
if (total <= yValue) {
|
|
@@ -132,12 +127,10 @@ const useKeyboardNavigation = () => {
|
|
|
132
127
|
} else if (yValue > xScrollbarPosition * containerRatio + innerHeight)
|
|
133
128
|
setXScrollbarPosition((prev) => {
|
|
134
129
|
const nextPosition = prev + (yValue / containerRatio - prev);
|
|
135
|
-
if (nextPosition + barWidth > innerHeight)
|
|
136
|
-
return innerHeight - barWidth;
|
|
130
|
+
if (nextPosition + barWidth > innerHeight) return innerHeight - barWidth;
|
|
137
131
|
return nextPosition;
|
|
138
132
|
});
|
|
139
|
-
else if (yValue < xScrollbarPosition * containerRatio)
|
|
140
|
-
setXScrollbarPosition(yValue / containerRatio);
|
|
133
|
+
else if (yValue < xScrollbarPosition * containerRatio) setXScrollbarPosition(yValue / containerRatio);
|
|
141
134
|
}
|
|
142
135
|
},
|
|
143
136
|
[
|
|
@@ -170,22 +163,17 @@ const useKeyboardNavigation = () => {
|
|
|
170
163
|
);
|
|
171
164
|
const onInputKeyDown = (0, import_react.useCallback)(
|
|
172
165
|
(e) => {
|
|
173
|
-
if (!activePoint)
|
|
174
|
-
return;
|
|
166
|
+
if (!activePoint) return;
|
|
175
167
|
if (e.code !== "Tab") {
|
|
176
168
|
e.preventDefault();
|
|
177
169
|
}
|
|
178
170
|
if (["ArrowLeft", "ArrowRight"].includes(e.code)) {
|
|
179
|
-
if (yScale?.type === "BAND")
|
|
180
|
-
|
|
181
|
-
else
|
|
182
|
-
navigateSerie(e.code === "ArrowLeft" ? -1 : 1);
|
|
171
|
+
if (yScale?.type === "BAND") changeSerie(e.code === "ArrowLeft" ? -1 : 1);
|
|
172
|
+
else navigateSerie(e.code === "ArrowLeft" ? -1 : 1);
|
|
183
173
|
}
|
|
184
174
|
if (["ArrowDown", "ArrowUp"].includes(e.code)) {
|
|
185
|
-
if (yScale?.type === "BAND")
|
|
186
|
-
|
|
187
|
-
else
|
|
188
|
-
changeSerie(e.code === "ArrowDown" ? -1 : 1);
|
|
175
|
+
if (yScale?.type === "BAND") navigateSerie(e.code === "ArrowDown" ? 1 : -1);
|
|
176
|
+
else changeSerie(e.code === "ArrowDown" ? -1 : 1);
|
|
189
177
|
}
|
|
190
178
|
const { code } = e;
|
|
191
179
|
const isShiftKey = ["ShiftLeft", "ShiftRight"].includes(code);
|
|
@@ -211,10 +199,8 @@ const useKeyboardNavigation = () => {
|
|
|
211
199
|
);
|
|
212
200
|
const handleOnKeyUp = (0, import_react.useCallback)(
|
|
213
201
|
(e) => {
|
|
214
|
-
if (!activePoint)
|
|
215
|
-
|
|
216
|
-
if (!isZooming && xScale?.type === "BAND")
|
|
217
|
-
return false;
|
|
202
|
+
if (!activePoint) return;
|
|
203
|
+
if (!isZooming && xScale?.type === "BAND") return false;
|
|
218
204
|
const { shiftKey, code } = e;
|
|
219
205
|
const isShiftKey = ["ShiftLeft", "ShiftRight"].includes(code);
|
|
220
206
|
const xScaledActivePoint = getXScaleValue(activePoint);
|
|
@@ -231,14 +217,11 @@ const useKeyboardNavigation = () => {
|
|
|
231
217
|
const offSetXScaledActivePoint = getXScaleValue(currentSerie?.data[offsetActivePoint]);
|
|
232
218
|
const correctEndingPosition = offSetXScaledActivePoint ?? 0 - xScrollbarPosition * containerRatio;
|
|
233
219
|
const diff = Math.abs(zoomStartingPosition - correctEndingPosition);
|
|
234
|
-
if (diff <= 0)
|
|
235
|
-
return;
|
|
220
|
+
if (diff <= 0) return;
|
|
236
221
|
const newRatio = innerWidth / (innerWidth * containerRatio / diff) < 40 ? innerWidth / 40 : innerWidth * containerRatio / diff;
|
|
237
222
|
const newPosition = lastScrollbarPosition?.current + (!isRightDirection ? correctEndingPosition : zoomStartingPosition) / containerRatio;
|
|
238
|
-
if (newPosition > innerWidth - innerWidth / newRatio)
|
|
239
|
-
|
|
240
|
-
else
|
|
241
|
-
setXScrollbarPosition(newPosition);
|
|
223
|
+
if (newPosition > innerWidth - innerWidth / newRatio) setXScrollbarPosition(innerWidth - innerWidth / newRatio);
|
|
224
|
+
else setXScrollbarPosition(newPosition);
|
|
242
225
|
setActivePoint(null);
|
|
243
226
|
setTimeout(() => setActivePoint(activePoint));
|
|
244
227
|
setContainerRatio(newRatio);
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/graphs/Chart/config/useKeyboardNavigation.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
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.js';\n\nexport const findInCircularList = (\n list: string[],\n from: number,\n step = 1,\n criteria = (item: number) => item !== undefined,\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] && criteria(i)) {\n return i;\n }\n }\n return from; // return same item\n};\n\nexport const useKeyboardNavigation = () => {\n const {\n activePoint,\n setActivePoint,\n containerRef,\n xScale,\n yScale,\n lastScrollbarPosition,\n setXScrollbarPosition,\n containerRatio,\n xScrollbarPosition,\n innerWidth,\n innerHeight,\n getXScaleValue,\n getYScaleValue,\n groups,\n isZooming,\n setIsZooming,\n zoomStartingPosition,\n setZoomStartingPosition,\n setMovingPosition,\n setContainerRatio,\n currentDataWithNullValues,\n props: { xScroll, yScroll },\n } = useContext(ChartContext);\n\n const currentSerie = useMemo(\n () => currentDataWithNullValues.find((d) => d.name === activePoint?.serie) ?? currentDataWithNullValues[0],\n [activePoint?.serie, currentDataWithNullValues],\n );\n\n const currentActiveItemIndex = useMemo(\n () => currentSerie?.data.findIndex((opt) => opt.key === activePoint?.key),\n [activePoint, currentSerie],\n );\n\n const listMap = useMemo(\n () =>\n currentSerie?.data.map((d) => {\n if (typeof d.value === 'object') return JSON.stringify(d.value);\n return d.value?.toString();\n }) ?? [],\n [currentSerie?.data],\n );\n\n const handleOnFocus: React.FocusEventHandler<HTMLDivElement> = useCallback(\n (e) => {\n if (containerRef === e.target && activePoint === null) {\n setActivePoint(currentSerie?.data[0]);\n setXScrollbarPosition(0);\n }\n },\n [activePoint, containerRef, currentSerie?.data, setActivePoint, setXScrollbarPosition],\n );\n\n const handleOnBlur: React.FocusEventHandler<HTMLInputElement> = useCallback(() => {\n setTimeout(() => {\n if (!containerRef?.contains(document.activeElement)) {\n setActivePoint(null);\n }\n });\n }, [setActivePoint, containerRef]);\n\n const navigateSerie = useCallback(\n (step: number) => {\n const newValue = findInCircularList(listMap, currentActiveItemIndex, step);\n setActivePoint(currentSerie?.data[newValue]);\n\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) setXScrollbarPosition(xValue / containerRatio);\n } else 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) setXScrollbarPosition(yValue / containerRatio);\n }\n },\n [\n listMap,\n currentActiveItemIndex,\n setActivePoint,\n currentSerie?.data,\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 nextSerieIndex = findInCircularList(\n groups,\n groups.findIndex((item) => item === currentSerie.name),\n step,\n (idx: number) => currentDataWithNullValues[idx].data[currentActiveItemIndex].value !== null,\n );\n setActivePoint(currentDataWithNullValues[nextSerieIndex].data[currentActiveItemIndex]);\n },\n [groups, setActivePoint, currentActiveItemIndex, currentSerie.name, currentDataWithNullValues],\n );\n\n const onInputKeyDown: React.KeyboardEventHandler<HTMLDivElement> = useCallback(\n (e) => {\n if (!activePoint) return;\n if (e.code !== 'Tab') {\n e.preventDefault();\n }\n if (['ArrowLeft', 'ArrowRight'].includes(e.code)) {\n if (yScale?.type === 'BAND') 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?.type === 'BAND') navigateSerie(e.code === 'ArrowDown' ? 1 : -1);\n else changeSerie(e.code === 'ArrowDown' ? -1 : 1);\n }\n\n const { code } = e;\n const isShiftKey = ['ShiftLeft', 'ShiftRight'].includes(code);\n\n const xScaledActivePoint = getXScaleValue(activePoint);\n if (isShiftKey && !isZooming && xScale?.type !== 'BAND' && xScaledActivePoint) {\n setIsZooming(true);\n setZoomStartingPosition(xScaledActivePoint - xScrollbarPosition * containerRatio);\n }\n },\n [\n activePoint,\n changeSerie,\n containerRatio,\n getXScaleValue,\n isZooming,\n navigateSerie,\n setIsZooming,\n setZoomStartingPosition,\n xScale?.type,\n xScrollbarPosition,\n yScale?.type,\n ],\n );\n\n const handleOnKeyUp: React.KeyboardEventHandler<HTMLDivElement> = useCallback(\n (e) => {\n if (!activePoint) return;\n\n if (!isZooming && xScale?.type === 'BAND') return false;\n const { shiftKey, code } = e;\n const isShiftKey = ['ShiftLeft', 'ShiftRight'].includes(code);\n\n const xScaledActivePoint = getXScaleValue(activePoint);\n\n if (shiftKey && ['ArrowRight', 'ArrowLeft'].includes(code) && xScaledActivePoint) {\n setMovingPosition(xScaledActivePoint - xScrollbarPosition * containerRatio);\n }\n if (isShiftKey && xScaledActivePoint) {\n setIsZooming(false);\n setZoomStartingPosition(0);\n setMovingPosition(0);\n const endingPosition = xScaledActivePoint - xScrollbarPosition * containerRatio;\n // isRightDirection is used to know if we are zooming right or left direction\n const isRightDirection = zoomStartingPosition < endingPosition;\n const offsetActivePoint = findInCircularList(listMap, currentActiveItemIndex, isRightDirection ? 1 : -1);\n // we do this so the activePoint does not fall into the blur gradient\n const offSetXScaledActivePoint = getXScaleValue(currentSerie?.data[offsetActivePoint]);\n const correctEndingPosition = offSetXScaledActivePoint ?? 0 - xScrollbarPosition * containerRatio;\n const diff = Math.abs(zoomStartingPosition - correctEndingPosition);\n if (diff <= 0) return;\n const newRatio =\n innerWidth / ((innerWidth * containerRatio) / diff) < 40\n ? innerWidth / 40\n : (innerWidth * containerRatio) / diff;\n const newPosition =\n lastScrollbarPosition?.current +\n (!isRightDirection ? correctEndingPosition : zoomStartingPosition) / containerRatio;\n\n // if is bigger thant innerwidth possible we force the end\n if (newPosition > innerWidth - innerWidth / newRatio) setXScrollbarPosition(innerWidth - innerWidth / newRatio);\n else setXScrollbarPosition(newPosition);\n setActivePoint(null);\n setTimeout(() => setActivePoint(activePoint));\n setContainerRatio(newRatio);\n lastScrollbarPosition.current = newPosition;\n }\n },\n [\n activePoint,\n containerRatio,\n currentActiveItemIndex,\n currentSerie?.data,\n getXScaleValue,\n\n innerWidth,\n isZooming,\n lastScrollbarPosition,\n listMap,\n setActivePoint,\n setContainerRatio,\n setIsZooming,\n setMovingPosition,\n setXScrollbarPosition,\n setZoomStartingPosition,\n xScale?.type,\n xScrollbarPosition,\n zoomStartingPosition,\n ],\n );\n return useMemo(\n () => ({ handleOnKeyUp, onInputKeyDown, handleOnBlur, handleOnFocus }),\n [handleOnBlur, handleOnFocus, handleOnKeyUp, 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;AAEtB,MAAM,qBAAqB,CAChC,MACA,MACA,OAAO,GACP,WAAW,CAAC,SAAiB,SAAS,WAE3B;AACX,WACM,KAAK,OAAO,OAAO,KAAK,UAAU,KAAK,QAC3C,MAAM,QAAQ,OAAO,IACrB,KAAK,IAAI,OAAO,KAAK,UAAU,KAAK,QACpC;AACA,QAAI,KAAK,CAAC,KAAK,SAAS,CAAC,GAAG;AAC1B,aAAO;AAAA,IACT;AAAA,EACF;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,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,SAAS,QAAQ;AAAA,EAC5B,QAAI,yBAAW,gCAAY;AAE3B,QAAM,mBAAe;AAAA,IACnB,MAAM,0BAA0B,KAAK,CAA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|
|
76
76
|
const getMin = () => {
|
|
77
77
|
const aux = [];
|
|
78
|
-
if (typeof begin === "number" || typeof begin === "object")
|
|
79
|
-
|
|
80
|
-
if (
|
|
81
|
-
aux.push(minData);
|
|
82
|
-
if (typeof minStackedData === "number")
|
|
83
|
-
aux.push(minStackedData);
|
|
78
|
+
if (typeof begin === "number" || typeof begin === "object") aux.push(begin);
|
|
79
|
+
if (types.includes(typeof minData) && minData !== void 0) aux.push(minData);
|
|
80
|
+
if (typeof minStackedData === "number") aux.push(minStackedData);
|
|
84
81
|
return (0, import_d3.min)(aux);
|
|
85
82
|
};
|
|
86
83
|
const getMax = () => {
|
|
87
84
|
const aux = [];
|
|
88
|
-
if (typeof begin === "number" || typeof begin === "object")
|
|
89
|
-
|
|
90
|
-
if (typeof
|
|
91
|
-
|
|
92
|
-
if (types.includes(typeof maxData) && maxData !== void 0)
|
|
93
|
-
aux.push(maxData);
|
|
94
|
-
if (typeof maxStackedData === "number")
|
|
95
|
-
aux.push(maxStackedData);
|
|
85
|
+
if (typeof begin === "number" || typeof begin === "object") aux.push(begin);
|
|
86
|
+
if (typeof end === "number" || typeof end === "object") aux.push(end);
|
|
87
|
+
if (types.includes(typeof maxData) && maxData !== void 0) aux.push(maxData);
|
|
88
|
+
if (typeof maxStackedData === "number") aux.push(maxStackedData);
|
|
96
89
|
return (0, import_d3.max)(aux);
|
|
97
90
|
};
|
|
98
91
|
const minRange = getMin();
|
|
@@ -123,8 +116,7 @@ const useScales = ({
|
|
|
123
116
|
const getScaleLog = (domain, range) => (0, import_d3.scaleLog)().domain(domain).range(range);
|
|
124
117
|
const scaleFactory = (0, import_react.useCallback)(
|
|
125
118
|
(axis, axisProps, range = []) => {
|
|
126
|
-
if (!axisProps)
|
|
127
|
-
return null;
|
|
119
|
+
if (!axisProps) return null;
|
|
128
120
|
if (["time", "datetime"].includes(axisProps?.type)) {
|
|
129
121
|
return new import_scales.TimeLinearScale(getScaleTime(getLinearDomain(axisProps, axis), range), axisProps);
|
|
130
122
|
}
|
|
@@ -178,8 +170,7 @@ const useScales = ({
|
|
|
178
170
|
).map((serie) => serie.name);
|
|
179
171
|
if (stackedSeries?.length) {
|
|
180
172
|
stackedSeries.forEach((stackedGroup, i) => {
|
|
181
|
-
if (stackedGroup.length > 0)
|
|
182
|
-
data.push(`stacked-data-${i}`);
|
|
173
|
+
if (stackedGroup.length > 0) data.push(`stacked-data-${i}`);
|
|
183
174
|
});
|
|
184
175
|
}
|
|
185
176
|
return data;
|
|
@@ -193,11 +184,9 @@ const useScales = ({
|
|
|
193
184
|
}
|
|
194
185
|
const bars = currentData.filter((serie) => serie.type === "bar");
|
|
195
186
|
const barsLength = bars.length;
|
|
196
|
-
if (!barsLength)
|
|
197
|
-
return 0;
|
|
187
|
+
if (!barsLength) return 0;
|
|
198
188
|
const maxDataLength = Math.max(...bars.map((bar) => bar.data.length));
|
|
199
|
-
if (xScale && xScale instanceof import_scales.BandScale)
|
|
200
|
-
return 0;
|
|
189
|
+
if (xScale && xScale instanceof import_scales.BandScale) return 0;
|
|
201
190
|
const divisor = Math.max(
|
|
202
191
|
maxDataLength,
|
|
203
192
|
xScale?.scale.ticks().length ?? 0,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/graphs/Chart/config/useScales.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable complexity */\n/* eslint-disable max-statements */\n/* eslint-disable indent */\nimport { useMemo, useCallback } from 'react';\nimport type { Series } from 'd3';\nimport { max, min, scaleLinear, scaleBand, scaleUtc, scaleOrdinal, scaleLog } from 'd3';\nimport type { DSChartT } from '../react-desc-prop-types.js';\nimport { getStackedIndex } from '../helpers/index.js';\nimport { COLOR_PALLET } from '../helpers/colorPallet.js';\nimport { TIME_OFFSET } from '../../constants.js';\nimport { BandScale, LinearScale, TimeLinearScale, LogScale } from '../scales/index.js';\ninterface UseScales {\n props: DSChartT.Props;\n innerHeight: number;\n innerWidth: number;\n originalSeries: DSChartT.SeriesT[];\n stackedData: Series<\n {\n [key: string]: number;\n },\n string\n >[][];\n currentData: DSChartT.InternalData;\n groups: string[];\n containerRatio: number;\n scalesStackedDataMap: string[];\n}\n\nexport const useScales = ({\n props,\n originalSeries: series,\n innerHeight,\n innerWidth,\n stackedData,\n currentData,\n scalesStackedDataMap,\n containerRatio,\n}: UseScales) => {\n const { xAxis, yAxis, y2Axis, groups: stackedSeries, xScroll, yScroll } = props;\n\n const getBandDomain = useCallback(\n (axis: DSChartT.AxisT) => axis.cols ?? [...series[0].data.map((_, i) => i.toString())],\n [series],\n );\n\n const getPadding = (domainPadding?: number | Array<number>) =>\n typeof domainPadding === 'number' ? [domainPadding, domainPadding] : domainPadding ?? [0, 0];\n\n const getLinearDomain = useCallback(\n (axis: DSChartT.AxisT, axisString: 'x' | 'y' | 'y2') => {\n // we are calculating the min and max between all the data\n // including the stacked groups if exists\n const begin = axis?.beginAtZero ? 0 : axis.min ?? undefined;\n const end = axis.max ?? undefined;\n const data = currentData\n // we filter the data based on scale.. if is x axis we dont because theres no x2 axis\n .filter((serie) => serie.scale === axisString || axisString === 'x')\n .map((serie) =>\n serie.data\n .filter((datum) => datum.value !== null)\n .map((datum) => {\n if (typeof datum.value === 'number') {\n return datum.value;\n }\n\n return datum.value[axisString === 'y2' ? 'y' : axisString];\n }),\n );\n const dataFlattened = data.flat();\n const stackedDataFlatten = stackedData.filter((_, i) => scalesStackedDataMap[i] === axisString).flat();\n const minStackedData = min(stackedDataFlatten, (layer) => min(layer, (sequence) => sequence[0]));\n const maxStackedData = max(stackedDataFlatten, (layer) => max(layer, (sequence) => sequence[1]));\n const minData = min(dataFlattened);\n const maxData = max(dataFlattened);\n const types = ['number', 'object'];\n const getMin = () => {\n const aux: (number | Date)[] = [];\n if (typeof begin === 'number' || typeof begin === 'object') aux.push(begin);\n if (types.includes(typeof minData) && minData !== undefined) aux.push(minData);\n if (typeof minStackedData === 'number') aux.push(minStackedData);\n return min(aux);\n };\n const getMax = () => {\n const aux: (number | Date)[] = [];\n if (typeof begin === 'number' || typeof begin === 'object') aux.push(begin);\n if (typeof end === 'number' || typeof end === 'object') aux.push(end);\n if (types.includes(typeof maxData) && maxData !== undefined) aux.push(maxData);\n if (typeof maxStackedData === 'number') aux.push(maxStackedData);\n return max(aux);\n };\n const minRange = getMin();\n const maxRange = getMax();\n\n const [leftPadding, rightPadding] = getPadding(axis.domainPadding);\n\n if (typeof minRange === 'number' && typeof maxRange === 'number') {\n // @TODO fix this domain padding\n return [\n minRange - (maxRange - minRange) * (leftPadding ?? 0),\n maxRange + (maxRange - minRange) * (rightPadding ?? 0),\n ];\n }\n // timelinear case\n if (typeof minRange === 'object' && typeof maxRange === 'object') {\n if (axis.domainPaddingType && TIME_OFFSET[axis.domainPaddingType]) {\n return [\n TIME_OFFSET[axis.domainPaddingType].offset(minRange, -leftPadding),\n TIME_OFFSET[axis.domainPaddingType].offset(maxRange, rightPadding),\n ];\n }\n return [minRange, maxRange];\n }\n\n return [];\n },\n [currentData, scalesStackedDataMap, stackedData],\n );\n\n // d3 scale functions\n const getScaleTime = (domain: Date[], range: number[]) => scaleUtc().domain(domain).range(range);\n\n const getScaleBand = (domain: string[], range: number[], padding = 0.2) =>\n scaleBand().domain(domain).range(range).padding(padding).paddingOuter(0.05);\n const getScaleLinear = (domain: number[], range: number[]) => scaleLinear().domain(domain).range(range);\n const getScaleLog = (domain: number[], range: number[]) => scaleLog().domain(domain).range(range);\n\n // dataviz scales\n\n const scaleFactory = useCallback(\n (axis: 'x' | 'y' | 'y2', axisProps?: DSChartT.AxisT, range: number[] = []) => {\n if (!axisProps) return null;\n if (['time', 'datetime'].includes(axisProps?.type)) {\n return new TimeLinearScale(getScaleTime(getLinearDomain(axisProps, axis) as Date[], range), axisProps);\n }\n\n if (axisProps?.type === 'linear' || (['y', 'y2'].includes(axis) && axisProps?.type === undefined)) {\n return new LinearScale(getScaleLinear(getLinearDomain(axisProps, axis) as number[], range), axisProps);\n }\n\n if (axisProps?.type === 'log')\n return new LogScale(getScaleLog(getLinearDomain(axisProps, axis) as number[], range), axisProps);\n\n if (axisProps?.type === 'band' || (axis === 'x' && axisProps?.type === undefined)) {\n // we need to reverse the range in case is a horizontal bar char\n const realRange = axis === 'y' ? range.reverse() : range;\n return new BandScale(getScaleBand(getBandDomain(axisProps), realRange), axisProps);\n }\n return null;\n },\n [getBandDomain, getLinearDomain],\n );\n\n const xRangeFrom = useMemo(() => containerRatio * (xAxis?.plotRange?.[0] || 0), [containerRatio, xAxis?.plotRange]);\n const xRangeTo = useMemo(\n () => (innerWidth - (xAxis?.plotRange?.[1] || 0)) * (xScroll ? containerRatio : 1),\n [containerRatio, innerWidth, xAxis?.plotRange, xScroll],\n );\n\n const yRangeTo = useMemo(() => yAxis?.plotRange?.[0] || 0, [yAxis?.plotRange]);\n const yRangeFrom = useMemo(\n () => (innerHeight - (yAxis?.plotRange?.[1] || 0)) * (yScroll ? containerRatio : 1),\n [containerRatio, innerHeight, yAxis?.plotRange, yScroll],\n );\n\n const y2RangeTo = useMemo(() => y2Axis?.plotRange?.[0] || 0, [y2Axis?.plotRange]);\n const y2RangeFrom = useMemo(\n () => (innerHeight - (y2Axis?.plotRange?.[1] || 0)) * (yScroll ? containerRatio : 1),\n [containerRatio, innerHeight, y2Axis?.plotRange, yScroll],\n );\n\n const xScale = useMemo(\n () => scaleFactory('x', xAxis, [xRangeFrom, xRangeTo]),\n [scaleFactory, xAxis, xRangeFrom, xRangeTo],\n );\n\n const yScale = useMemo(\n () => scaleFactory('y', yAxis, [yRangeFrom, yRangeTo]),\n [scaleFactory, yAxis, yRangeFrom, yRangeTo],\n );\n\n const y2Scale = useMemo(\n () => scaleFactory('y2', y2Axis, [y2RangeFrom, y2RangeTo]),\n [scaleFactory, y2Axis, y2RangeFrom, y2RangeTo],\n );\n\n const colorScale = useMemo(\n () =>\n scaleOrdinal()\n .domain(series.map((d) => d.name))\n .range(series.map((d) => COLOR_PALLET[d.color as keyof typeof COLOR_PALLET] ?? d.color))\n .unknown('red'),\n [series],\n );\n // get only groups bars to calculate the subgroup scale\n\n const subgroupsWithBars = useMemo(() => {\n const data = currentData\n .filter(\n (serie) => serie.type === 'bar' && !(stackedSeries?.length && getStackedIndex(stackedSeries, serie.name) > -1),\n )\n .map((serie) => serie.name);\n\n if (stackedSeries?.length) {\n stackedSeries.forEach((stackedGroup, i) => {\n if (stackedGroup.length > 0) data.push(`stacked-data-${i}`);\n });\n }\n return data;\n }, [currentData, stackedSeries]);\n\n const getBandwidth = useCallback(() => {\n if (xScale?.type === 'BAND') {\n return xScale?.getBandwidth();\n }\n if (yScale?.type === 'BAND') {\n return yScale?.getBandwidth();\n }\n // @todo explore this. is to create bars with a linear axis\n const bars = currentData.filter((serie) => serie.type === 'bar');\n const barsLength = bars.length;\n if (!barsLength) return 0;\n // we get the size of the bars using the length of the data or the ticks amounts\n // the biggest is the one we use to get the real width we need.\n // we are doing calculations only for x axis because we are not expecting\n // y axis linear cases.\n const maxDataLength = Math.max(...bars.map((bar) => bar.data.length));\n if (xScale && xScale instanceof BandScale) return 0;\n const divisor = Math.max(\n maxDataLength,\n xScale?.scale.ticks().length ?? 0,\n xScale?.getTicks(innerWidth, '').length ?? 0,\n 1,\n );\n\n const width = innerWidth / divisor;\n if (containerRatio > 1) {\n return Math.max(0.5, width * containerRatio);\n }\n // this reduce the width of the bars under small width graphs\n const modificator = innerWidth > 400 ? 0.5 : 0.8;\n return Math.max(0.5, Math.min(20, Math.trunc(width - width * modificator)));\n }, [currentData, innerWidth, containerRatio, xScale, yScale]);\n\n const subGroupScale = useMemo(\n () =>\n getBandwidth()\n ? scaleBand()\n .domain(subgroupsWithBars)\n .range([0, getBandwidth()])\n .paddingInner(0.55)\n .padding(0.2)\n .paddingOuter(0.01)\n : null,\n [getBandwidth, subgroupsWithBars],\n );\n\n return { xScale, y2Scale, yScale, subGroupScale, colorScale, getBandwidth };\n};\n", "import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|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/graphs/Chart/config/useValidateProps.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["//\nimport type { DSChartT } from '../react-desc-prop-types.js';\nexport const useValidateProps = (props: DSChartT.Props): void => {\n const componentName = 'Chart';\n\n if (props.series?.length === 0 || !props.series) {\n throw new Error(`${componentName}:: series is required or cannot be an empty array`);\n }\n // todo use generic useValidateTypescriptPropTypes for the rest of the props\n // useValidateTypescriptPropTypes(props, propTypes);\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEhB,MAAM,mBAAmB,CAAC,UAAgC;AAC/D,QAAM,gBAAgB;AAEtB,MAAI,MAAM,QAAQ,WAAW,KAAK,CAAC,MAAM,QAAQ;AAC/C,UAAM,IAAI,MAAM,GAAG,
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEhB,MAAM,mBAAmB,CAAC,UAAgC;AAC/D,QAAM,gBAAgB;AAEtB,MAAI,MAAM,QAAQ,WAAW,KAAK,CAAC,MAAM,QAAQ;AAC/C,UAAM,IAAI,MAAM,GAAG,aAAa,mDAAmD;AAAA,EACrF;AAGF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|