@splunk/visualizations 28.5.3 → 28.7.0
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/Area/Area.d.ts.map +1 -1
- package/Area/areaUtils.d.ts +1 -1
- package/Area/areaUtils.d.ts.map +1 -1
- package/Area/config.d.ts.map +1 -1
- package/Area.config.js +93 -25
- package/Area.config.js.map +3 -3
- package/Area.js +708 -319
- package/Area.js.map +4 -4
- package/Bar/Bar.d.ts.map +1 -1
- package/Bar.config.js +81 -24
- package/Bar.config.js.map +3 -3
- package/Bar.js +528 -297
- package/Bar.js.map +4 -4
- package/Bubble.config.js +80 -23
- package/Bubble.config.js.map +2 -2
- package/Bubble.js +375 -208
- package/Bubble.js.map +4 -4
- package/CHANGELOG.external.md +75 -60
- package/ChoroplethSvg/PureChoroplethSvg/PureChoroplethSvg.d.ts +1 -0
- package/ChoroplethSvg/PureChoroplethSvg/PureChoroplethSvg.d.ts.map +1 -1
- package/ChoroplethSvg/PureChoroplethSvg/SvgChoroplethDynamic.d.ts +12 -25
- package/ChoroplethSvg/PureChoroplethSvg/SvgChoroplethDynamic.d.ts.map +1 -1
- package/ChoroplethSvg/PureChoroplethSvg/SvgMutator.d.ts +11 -4
- package/ChoroplethSvg/PureChoroplethSvg/SvgMutator.d.ts.map +1 -1
- package/ChoroplethSvg.js +1133 -253
- package/ChoroplethSvg.js.map +4 -4
- package/Column/Column.d.ts.map +1 -1
- package/Column.config.js +81 -24
- package/Column.config.js.map +3 -3
- package/Column.js +531 -300
- package/Column.js.map +4 -4
- package/Ellipse.config.js +1 -1
- package/Ellipse.config.js.map +2 -2
- package/Ellipse.js +277 -161
- package/Ellipse.js.map +4 -4
- package/Events/PureEvents/FieldSummaryTooltip.d.ts +8 -31
- package/Events/PureEvents/FieldSummaryTooltip.d.ts.map +1 -1
- package/Events/PureEvents/PureEvents.d.ts.map +1 -1
- package/Events/PureEvents/TimeControlsPopover.d.ts +6 -25
- package/Events/PureEvents/TimeControlsPopover.d.ts.map +1 -1
- package/Events/config.d.ts.map +1 -1
- package/Events.config.js +13 -3
- package/Events.config.js.map +2 -2
- package/Events.js +355 -293
- package/Events.js.map +4 -4
- package/FillerGauge/FillerGauge.d.ts.map +1 -1
- package/FillerGauge/config.d.ts.map +1 -1
- package/FillerGauge.config.js +76 -24
- package/FillerGauge.config.js.map +2 -2
- package/FillerGauge.js +512 -271
- package/FillerGauge.js.map +4 -4
- package/Image/config.d.ts.map +1 -1
- package/Image.config.js +7 -0
- package/Image.config.js.map +2 -2
- package/Image.js +282 -149
- package/Image.js.map +4 -4
- package/LICENSE +13 -0
- package/Line/Line.d.ts.map +1 -1
- package/Line/config.d.ts.map +1 -1
- package/Line/lineUtils.d.ts.map +1 -1
- package/Line/mockdata/LineData.d.ts +21 -0
- package/Line/mockdata/LineData.d.ts.map +1 -1
- package/Line.config.js +86 -25
- package/Line.config.js.map +3 -3
- package/Line.js +638 -382
- package/Line.js.map +4 -4
- package/LinkGraph/PureLinkGraph/PureLinkGraph.d.ts +47 -73
- package/LinkGraph/PureLinkGraph/PureLinkGraph.d.ts.map +1 -1
- package/LinkGraph/PureLinkGraph/PureLinkGraphUtils.d.ts +11 -2
- package/LinkGraph/PureLinkGraph/PureLinkGraphUtils.d.ts.map +1 -1
- package/LinkGraph/PureLinkGraph/components/Graph.d.ts +5 -5
- package/LinkGraph/PureLinkGraph/components/Node.d.ts +2 -2
- package/LinkGraph/PureLinkGraph/components/Nodes.d.ts +2 -2
- package/LinkGraph.js +886 -759
- package/LinkGraph.js.map +4 -4
- package/Map/Map.d.ts +1 -0
- package/Map/Map.d.ts.map +1 -1
- package/Map/PureMap/BubbleLayer.d.ts +22 -4
- package/Map/PureMap/BubbleLayer.d.ts.map +1 -1
- package/Map/PureMap/ChoroplethLayer.d.ts +9 -1
- package/Map/PureMap/ChoroplethLayer.d.ts.map +1 -1
- package/Map/PureMap/ClusterLayer.d.ts +3 -1
- package/Map/PureMap/ClusterLayer.d.ts.map +1 -1
- package/Map/PureMap/LocalChoroplethLayer.d.ts +1 -0
- package/Map/PureMap/LocalChoroplethLayer.d.ts.map +1 -1
- package/Map/PureMap/MapContext.d.ts +13 -0
- package/Map/PureMap/MapContext.d.ts.map +1 -0
- package/Map/PureMap/MarkerLayer.d.ts +19 -2
- package/Map/PureMap/MarkerLayer.d.ts.map +1 -1
- package/Map/PureMap/MarkerWrapper.d.ts +3 -2
- package/Map/PureMap/MarkerWrapper.d.ts.map +1 -1
- package/Map/PureMap/PureMap.d.ts +1 -0
- package/Map/PureMap/PureMap.d.ts.map +1 -1
- package/Map/PureMap/PureMapContainer.d.ts.map +1 -1
- package/Map/PureMap/Tooltip.d.ts +6 -1
- package/Map/PureMap/Tooltip.d.ts.map +1 -1
- package/Map/PureMap/keyboardConstants.d.ts +11 -0
- package/Map/PureMap/keyboardConstants.d.ts.map +1 -0
- package/Map/PureMap/useRovingTabindex.d.ts +18 -0
- package/Map/PureMap/useRovingTabindex.d.ts.map +1 -0
- package/Map/config.d.ts.map +1 -1
- package/Map.config.js +4 -1
- package/Map.config.js.map +2 -2
- package/Map.js +1594 -628
- package/Map.js.map +4 -4
- package/Markdown/Markdown.d.ts.map +1 -1
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +304 -161
- package/Markdown.js.map +4 -4
- package/MarkerGauge/MarkerGauge.d.ts +1 -47
- package/MarkerGauge/MarkerGauge.d.ts.map +1 -1
- package/MarkerGauge/PureMarkerGauge/MarkerGauge.d.ts +22 -68
- package/MarkerGauge/PureMarkerGauge/MarkerGauge.d.ts.map +1 -1
- package/MarkerGauge/config.d.ts.map +1 -1
- package/MarkerGauge.config.js +75 -23
- package/MarkerGauge.config.js.map +2 -2
- package/MarkerGauge.js +560 -375
- package/MarkerGauge.js.map +4 -4
- package/NetworkGraph/NetworkGraph.d.ts +2 -5
- package/NetworkGraph/NetworkGraph.d.ts.map +1 -1
- package/NetworkGraph/PureNetworkGraph/PureNetworkGraph.d.ts.map +1 -1
- package/NetworkGraph/PureNetworkGraph/components/NetworkGraphSvg.d.ts +1 -0
- package/NetworkGraph/PureNetworkGraph/components/NetworkGraphSvg.d.ts.map +1 -1
- package/NetworkGraph/PureNetworkGraph/components/Node.d.ts +1 -0
- package/NetworkGraph/PureNetworkGraph/components/Node.d.ts.map +1 -1
- package/NetworkGraph/PureNetworkGraph/components/Tooltip.d.ts +1 -1
- package/NetworkGraph/PureNetworkGraph/components/Tooltip.d.ts.map +1 -1
- package/NetworkGraph/PureNetworkGraph/components/ZoomControls.d.ts +1 -0
- package/NetworkGraph/PureNetworkGraph/components/ZoomControls.d.ts.map +1 -1
- package/NetworkGraph/PureNetworkGraph/utils/networkGraphUtils.d.ts +23 -0
- package/NetworkGraph/PureNetworkGraph/utils/networkGraphUtils.d.ts.map +1 -1
- package/NetworkGraph.config.js +2 -0
- package/NetworkGraph.config.js.map +2 -2
- package/NetworkGraph.js +895 -455
- package/NetworkGraph.js.map +4 -4
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +288 -172
- package/ParallelCoordinates.js.map +4 -4
- package/Pie/Pie.d.ts.map +1 -1
- package/Pie/pieUtils.d.ts +2 -2
- package/Pie.config.js +74 -22
- package/Pie.config.js.map +2 -2
- package/Pie.js +522 -296
- package/Pie.js.map +4 -4
- package/ProcessTree/ProcessTree.d.ts +23 -0
- package/ProcessTree/ProcessTree.d.ts.map +1 -0
- package/ProcessTree/PureProcessTree/PureProcessTree.d.ts +33 -0
- package/ProcessTree/PureProcessTree/PureProcessTree.d.ts.map +1 -0
- package/ProcessTree/PureProcessTree/components/DirectionalBytes.d.ts +8 -0
- package/ProcessTree/PureProcessTree/components/DirectionalBytes.d.ts.map +1 -0
- package/ProcessTree/PureProcessTree/components/ProcessTreeLeftPanel.d.ts +46 -0
- package/ProcessTree/PureProcessTree/components/ProcessTreeLeftPanel.d.ts.map +1 -0
- package/ProcessTree/PureProcessTree/components/ProcessTreeRightPanel.d.ts +20 -0
- package/ProcessTree/PureProcessTree/components/ProcessTreeRightPanel.d.ts.map +1 -0
- package/ProcessTree/PureProcessTree/hooks/useProcessTreeExpansionState.d.ts +20 -0
- package/ProcessTree/PureProcessTree/hooks/useProcessTreeExpansionState.d.ts.map +1 -0
- package/ProcessTree/PureProcessTree/hooks/useProcessTreeGraphData.d.ts +46 -0
- package/ProcessTree/PureProcessTree/hooks/useProcessTreeGraphData.d.ts.map +1 -0
- package/ProcessTree/PureProcessTree/hooks/useProcessTreeLinkOverlay.d.ts +23 -0
- package/ProcessTree/PureProcessTree/hooks/useProcessTreeLinkOverlay.d.ts.map +1 -0
- package/ProcessTree/PureProcessTree/mockdata/data.d.ts +235 -0
- package/ProcessTree/PureProcessTree/mockdata/data.d.ts.map +1 -0
- package/ProcessTree/PureProcessTree/utils/iconLoader.d.ts +9 -0
- package/ProcessTree/PureProcessTree/utils/iconLoader.d.ts.map +1 -0
- package/ProcessTree/PureProcessTree/utils/processTreeLinkOverlayUtils.d.ts +36 -0
- package/ProcessTree/PureProcessTree/utils/processTreeLinkOverlayUtils.d.ts.map +1 -0
- package/ProcessTree/PureProcessTree/utils/processTreeUtils.d.ts +82 -0
- package/ProcessTree/PureProcessTree/utils/processTreeUtils.d.ts.map +1 -0
- package/ProcessTree/config.d.ts +4 -0
- package/ProcessTree/config.d.ts.map +1 -0
- package/ProcessTree/index.d.ts +3 -0
- package/ProcessTree/index.d.ts.map +1 -0
- package/ProcessTree.config.js +192 -0
- package/ProcessTree.config.js.map +7 -0
- package/ProcessTree.js +5128 -0
- package/ProcessTree.js.map +7 -0
- package/Punchcard/Punchcard.d.ts +1 -5
- package/Punchcard/Punchcard.d.ts.map +1 -1
- package/Punchcard/PurePunchcard/Punchcard.d.ts +28 -32
- package/Punchcard/PurePunchcard/Punchcard.d.ts.map +1 -1
- package/Punchcard/PurePunchcard/src/PunchcardAxis.d.ts +7 -12
- package/Punchcard/PurePunchcard/src/PunchcardAxis.d.ts.map +1 -1
- package/Punchcard/PurePunchcard/src/PunchcardBubble.d.ts +14 -19
- package/Punchcard/PurePunchcard/src/PunchcardBubble.d.ts.map +1 -1
- package/Punchcard/PurePunchcard/src/PunchcardChartArea.d.ts +22 -27
- package/Punchcard/PurePunchcard/src/PunchcardChartArea.d.ts.map +1 -1
- package/Punchcard/PurePunchcard/src/PunchcardGridLines.d.ts +3 -8
- package/Punchcard/PurePunchcard/src/PunchcardGridLines.d.ts.map +1 -1
- package/Punchcard/PurePunchcard/src/PunchcardLegend.d.ts +9 -14
- package/Punchcard/PurePunchcard/src/PunchcardLegend.d.ts.map +1 -1
- package/Punchcard/PurePunchcard/src/PunchcardRow.d.ts.map +1 -1
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +444 -631
- package/Punchcard.js.map +4 -4
- package/README.md +2 -0
- package/Rectangle.config.js +1 -1
- package/Rectangle.config.js.map +2 -2
- package/Rectangle.js +289 -173
- package/Rectangle.js.map +4 -4
- package/RichText/PureRichText/Editor/EditorPanel.d.ts +20 -0
- package/RichText/PureRichText/Editor/EditorPanel.d.ts.map +1 -0
- package/RichText/PureRichText/Editor/EditorPanelStyles.d.ts +17 -0
- package/RichText/PureRichText/Editor/EditorPanelStyles.d.ts.map +1 -0
- package/RichText/PureRichText/Editor/FontSelector.d.ts +15 -0
- package/RichText/PureRichText/Editor/FontSelector.d.ts.map +1 -0
- package/RichText/PureRichText/Editor/FormatButton.d.ts +23 -0
- package/RichText/PureRichText/Editor/FormatButton.d.ts.map +1 -0
- package/RichText/PureRichText/Editor/editorPanelUtils.d.ts +19 -0
- package/RichText/PureRichText/Editor/editorPanelUtils.d.ts.map +1 -0
- package/RichText/PureRichText/Editor/hooks/useLineSpacing.d.ts +11 -0
- package/RichText/PureRichText/Editor/hooks/useLineSpacing.d.ts.map +1 -0
- package/RichText/PureRichText/Editor/hooks/useLinkHandlers.d.ts +26 -0
- package/RichText/PureRichText/Editor/hooks/useLinkHandlers.d.ts.map +1 -0
- package/RichText/PureRichText/Editor/index.d.ts +9 -0
- package/RichText/PureRichText/Editor/index.d.ts.map +1 -0
- package/RichText/PureRichText/InnerEditor.d.ts +41 -0
- package/RichText/PureRichText/InnerEditor.d.ts.map +1 -0
- package/RichText/PureRichText/PureRichText.d.ts +19 -0
- package/RichText/PureRichText/PureRichText.d.ts.map +1 -0
- package/RichText/PureRichText/PureRichTextContext.d.ts +64 -0
- package/RichText/PureRichText/PureRichTextContext.d.ts.map +1 -0
- package/RichText/PureRichText/RichTextStyles.d.ts +25 -0
- package/RichText/PureRichText/RichTextStyles.d.ts.map +1 -0
- package/RichText/PureRichText/activeInstance.d.ts +23 -0
- package/RichText/PureRichText/activeInstance.d.ts.map +1 -0
- package/RichText/PureRichText/config.d.ts +17 -0
- package/RichText/PureRichText/config.d.ts.map +1 -0
- package/RichText/PureRichText/hooks/index.d.ts +12 -0
- package/RichText/PureRichText/hooks/index.d.ts.map +1 -0
- package/RichText/PureRichText/hooks/useContentSave.d.ts +25 -0
- package/RichText/PureRichText/hooks/useContentSave.d.ts.map +1 -0
- package/RichText/PureRichText/hooks/useContentSync.d.ts +28 -0
- package/RichText/PureRichText/hooks/useContentSync.d.ts.map +1 -0
- package/RichText/PureRichText/hooks/useDashboardKeyboardNav.d.ts +33 -0
- package/RichText/PureRichText/hooks/useDashboardKeyboardNav.d.ts.map +1 -0
- package/RichText/PureRichText/hooks/useEditModeEffect.d.ts +10 -0
- package/RichText/PureRichText/hooks/useEditModeEffect.d.ts.map +1 -0
- package/RichText/PureRichText/hooks/useEditorSetup.d.ts +36 -0
- package/RichText/PureRichText/hooks/useEditorSetup.d.ts.map +1 -0
- package/RichText/PureRichText/hooks/useFakeHighlight.d.ts +33 -0
- package/RichText/PureRichText/hooks/useFakeHighlight.d.ts.map +1 -0
- package/RichText/PureRichText/hooks/useFocusHandlers.d.ts +35 -0
- package/RichText/PureRichText/hooks/useFocusHandlers.d.ts.map +1 -0
- package/RichText/PureRichText/hooks/useKeyboardShortcuts.d.ts +18 -0
- package/RichText/PureRichText/hooks/useKeyboardShortcuts.d.ts.map +1 -0
- package/RichText/PureRichText/hooks/useMouseHandlers.d.ts +24 -0
- package/RichText/PureRichText/hooks/useMouseHandlers.d.ts.map +1 -0
- package/RichText/PureRichText/hooks/useRichTextState.d.ts +38 -0
- package/RichText/PureRichText/hooks/useRichTextState.d.ts.map +1 -0
- package/RichText/PureRichText/hooks/useStepFontSize.d.ts +17 -0
- package/RichText/PureRichText/hooks/useStepFontSize.d.ts.map +1 -0
- package/RichText/PureRichText/hooks/useStepLineSpacing.d.ts +18 -0
- package/RichText/PureRichText/hooks/useStepLineSpacing.d.ts.map +1 -0
- package/RichText/PureRichText/hooks/useTokenMap.d.ts +45 -0
- package/RichText/PureRichText/hooks/useTokenMap.d.ts.map +1 -0
- package/RichText/PureRichText/index.d.ts +16 -0
- package/RichText/PureRichText/index.d.ts.map +1 -0
- package/RichText/PureRichText/renderers/ElementRenderer.d.ts +8 -0
- package/RichText/PureRichText/renderers/ElementRenderer.d.ts.map +1 -0
- package/RichText/PureRichText/renderers/LeafRenderer.d.ts +8 -0
- package/RichText/PureRichText/renderers/LeafRenderer.d.ts.map +1 -0
- package/RichText/PureRichText/types.d.ts +111 -0
- package/RichText/PureRichText/types.d.ts.map +1 -0
- package/RichText/PureRichText/utils/a11yUtils.d.ts +9 -0
- package/RichText/PureRichText/utils/a11yUtils.d.ts.map +1 -0
- package/RichText/PureRichText/utils/fontSize.d.ts +6 -0
- package/RichText/PureRichText/utils/fontSize.d.ts.map +1 -0
- package/RichText/PureRichText/utils/slateUtils.d.ts +99 -0
- package/RichText/PureRichText/utils/slateUtils.d.ts.map +1 -0
- package/RichText/RichText.d.ts +17 -0
- package/RichText/RichText.d.ts.map +1 -0
- package/RichText/config.d.ts +4 -0
- package/RichText/config.d.ts.map +1 -0
- package/RichText/index.d.ts +7 -0
- package/RichText/index.d.ts.map +1 -0
- package/RichText.config.js +268 -0
- package/RichText.config.js.map +7 -0
- package/RichText.js +7674 -0
- package/RichText.js.map +7 -0
- package/Sankey/PureSankey/PureSankey.d.ts.map +1 -1
- package/Sankey/PureSankey/SankeyLink.d.ts.map +1 -1
- package/Sankey/PureSankey/SankeyNode.d.ts +10 -3
- package/Sankey/PureSankey/SankeyNode.d.ts.map +1 -1
- package/Sankey/PureSankey/SankeyTooltip.d.ts.map +1 -1
- package/Sankey/PureSankey/SankeyUtils.d.ts +10 -0
- package/Sankey/PureSankey/SankeyUtils.d.ts.map +1 -1
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +562 -290
- package/Sankey.js.map +4 -4
- package/Scatter/Scatter.d.ts.map +1 -1
- package/Scatter.config.js +81 -24
- package/Scatter.config.js.map +3 -3
- package/Scatter.js +528 -297
- package/Scatter.js.map +4 -4
- package/SingleValue/SingleValue.d.ts.map +1 -1
- package/SingleValue/config.d.ts.map +1 -1
- package/SingleValue.config.js +76 -24
- package/SingleValue.config.js.map +2 -2
- package/SingleValue.js +896 -779
- package/SingleValue.js.map +4 -4
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon/SingleValueIcon.d.ts.map +1 -1
- package/SingleValueIcon/config.d.ts.map +1 -1
- package/SingleValueIcon.config.js +76 -24
- package/SingleValueIcon.config.js.map +2 -2
- package/SingleValueIcon.js +512 -287
- package/SingleValueIcon.js.map +4 -4
- package/SingleValueRadial/PureSingleValueRadial/utils/gaugeUtils.d.ts +0 -8
- package/SingleValueRadial/PureSingleValueRadial/utils/gaugeUtils.d.ts.map +1 -1
- package/SingleValueRadial/SingleValueRadial.d.ts.map +1 -1
- package/SingleValueRadial/config.d.ts.map +1 -1
- package/SingleValueRadial.config.js +76 -24
- package/SingleValueRadial.config.js.map +2 -2
- package/SingleValueRadial.js +543 -326
- package/SingleValueRadial.js.map +4 -4
- package/SparkLine/SparkLine.d.ts +57 -0
- package/SparkLine/SparkLine.d.ts.map +1 -0
- package/SparkLine/index.d.ts +1 -1
- package/SparkLine/index.d.ts.map +1 -1
- package/SparkLine.js +384 -485
- package/SparkLine.js.map +4 -4
- package/TRELLIS.md +48 -0
- package/Table/PureTable.d.ts +1 -0
- package/Table/PureTable.d.ts.map +1 -1
- package/Table/Table.d.ts.map +1 -1
- package/Table/cells/ArrayCell.d.ts.map +1 -1
- package/Table/config.d.ts.map +1 -1
- package/Table/hooks.d.ts +1 -1
- package/Table/hooks.d.ts.map +1 -1
- package/Table/tableUtils.d.ts +14 -0
- package/Table/tableUtils.d.ts.map +1 -0
- package/Table.config.js +4 -10
- package/Table.config.js.map +2 -2
- package/Table.js +1158 -846
- package/Table.js.map +4 -4
- package/Timeline/PureTimeline/src/TimelineYAxis.d.ts.map +1 -1
- package/Timeline/PureTimeline/src/utils/timelineUtils.d.ts +5 -0
- package/Timeline/PureTimeline/src/utils/timelineUtils.d.ts.map +1 -1
- package/Timeline/Timeline.d.ts +2 -0
- package/Timeline/Timeline.d.ts.map +1 -1
- package/Timeline/config.d.ts.map +1 -1
- package/Timeline/mockdata/timelineDataSource.d.ts +34 -0
- package/Timeline/mockdata/timelineDataSource.d.ts.map +1 -1
- package/Timeline.config.js +15 -0
- package/Timeline.config.js.map +2 -2
- package/Timeline.js +348 -186
- package/Timeline.js.map +4 -4
- package/common/Charting.d.ts.map +1 -1
- package/common/Charting.js +50 -28
- package/common/Charting.js.map +2 -2
- package/common/ChartingApi.d.ts +1 -1
- package/common/ChartingApi.d.ts.map +1 -1
- package/common/ChartingApi.js.map +2 -2
- package/common/DocExampleWithVizSandbox.js.map +1 -1
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.js.map +1 -1
- package/common/SplunkVisualization.d.ts +1 -1
- package/common/SplunkVisualization.d.ts.map +1 -1
- package/common/SplunkVisualization.js +6 -4
- package/common/SplunkVisualization.js.map +2 -2
- package/common/StyledSkipLink.d.ts +2 -0
- package/common/StyledSkipLink.d.ts.map +1 -0
- package/common/StyledSkipLink.js +81 -0
- package/common/StyledSkipLink.js.map +7 -0
- package/common/TimeSeriesChartWrapper.d.ts.map +1 -1
- package/common/TimeSeriesChartWrapper.js +228 -107
- package/common/TimeSeriesChartWrapper.js.map +4 -4
- package/common/chartingUtils.d.ts +32 -6
- package/common/chartingUtils.d.ts.map +1 -1
- package/common/chartingUtils.js +166 -39
- package/common/chartingUtils.js.map +4 -4
- package/common/components/TrellisTitle.d.ts.map +1 -1
- package/common/docUtils.js +1 -1
- package/common/docUtils.js.map +2 -2
- package/common/editorConfig/AxesChartDataDisplay.d.ts.map +1 -1
- package/common/editorConfig/AxesChartYGridAndLabels.d.ts.map +1 -1
- package/common/editorConfig/BackgroundColor.d.ts +2 -2
- package/common/editorConfig/TrellisEditors.d.ts +33 -5
- package/common/editorConfig/TrellisEditors.d.ts.map +1 -1
- package/common/hocs/mockdata/trellisData.d.ts +54 -0
- package/common/hocs/mockdata/trellisData.d.ts.map +1 -1
- package/common/hocs/withTrellis.d.ts +9 -0
- package/common/hocs/withTrellis.d.ts.map +1 -1
- package/common/hooks/useSorting.d.ts +2 -2
- package/common/hooks/useSorting.d.ts.map +1 -1
- package/common/shapeUtils.d.ts +1 -1
- package/common/shapeUtils.d.ts.map +1 -1
- package/common/shapeUtils.js.map +2 -2
- package/common/utils/dataUtils.js +2 -1
- package/common/utils/dataUtils.js.map +2 -2
- package/common/utils/focusUtils.d.ts +4 -0
- package/common/utils/focusUtils.d.ts.map +1 -0
- package/common/utils/focusUtils.js +101 -0
- package/common/utils/focusUtils.js.map +7 -0
- package/common/utils/mapUtils.js +513 -184
- package/common/utils/mapUtils.js.map +4 -4
- package/common/utils/shadowDomUtils.d.ts +2 -0
- package/common/utils/shadowDomUtils.d.ts.map +1 -0
- package/common/utils/shadowDomUtils.js +39 -0
- package/common/utils/shadowDomUtils.js.map +7 -0
- package/common/utils/singleValueUtils.js +14 -26
- package/common/utils/singleValueUtils.js.map +2 -2
- package/common/utils/trellisUtils.d.ts.map +1 -1
- package/common/utils/trellisUtils.js +76 -70
- package/common/utils/trellisUtils.js.map +2 -2
- package/common/withDashboardViz.d.ts.map +1 -1
- package/common/withDashboardViz.js +276 -151
- package/common/withDashboardViz.js.map +4 -4
- package/docs-llm/INDEX.md +118 -0
- package/docs-llm/area/examples-json.md +3854 -0
- package/docs-llm/area/examples-react.md +2816 -0
- package/docs-llm/area/options.md +97 -0
- package/docs-llm/area/overview.md +27 -0
- package/docs-llm/bar/examples-json.md +3380 -0
- package/docs-llm/bar/examples-react.md +2352 -0
- package/docs-llm/bar/options.md +89 -0
- package/docs-llm/bar/overview.md +25 -0
- package/docs-llm/bubble/examples-json.md +4082 -0
- package/docs-llm/bubble/examples-react.md +3977 -0
- package/docs-llm/bubble/options.md +62 -0
- package/docs-llm/bubble/overview.md +26 -0
- package/docs-llm/choropleth-svg/examples-json.md +397 -0
- package/docs-llm/choropleth-svg/examples-react.md +389 -0
- package/docs-llm/choropleth-svg/options.md +15 -0
- package/docs-llm/choropleth-svg/overview.md +23 -0
- package/docs-llm/column/examples-json.md +3898 -0
- package/docs-llm/column/examples-react.md +2653 -0
- package/docs-llm/column/options.md +94 -0
- package/docs-llm/column/overview.md +31 -0
- package/docs-llm/dsl/examples-json.md +43 -0
- package/docs-llm/dsl/examples-react.md +78 -0
- package/docs-llm/dsl/formatters/format-by-type-examples-json.md +58 -0
- package/docs-llm/dsl/formatters/format-by-type-examples-react.md +43 -0
- package/docs-llm/dsl/formatters/format-by-type.md +38 -0
- package/docs-llm/dsl/formatters/frame-examples-json.md +42 -0
- package/docs-llm/dsl/formatters/frame-examples-react.md +24 -0
- package/docs-llm/dsl/formatters/frame.md +6 -0
- package/docs-llm/dsl/formatters/gradient-examples-json.md +98 -0
- package/docs-llm/dsl/formatters/gradient-examples-react.md +44 -0
- package/docs-llm/dsl/formatters/gradient.md +23 -0
- package/docs-llm/dsl/formatters/lerp-examples-json.md +40 -0
- package/docs-llm/dsl/formatters/lerp-examples-react.md +28 -0
- package/docs-llm/dsl/formatters/lerp.md +19 -0
- package/docs-llm/dsl/formatters/match-value-examples-json.md +65 -0
- package/docs-llm/dsl/formatters/match-value-examples-react.md +37 -0
- package/docs-llm/dsl/formatters/match-value.md +13 -0
- package/docs-llm/dsl/formatters/max-contrast-examples-json.md +39 -0
- package/docs-llm/dsl/formatters/max-contrast-examples-react.md +27 -0
- package/docs-llm/dsl/formatters/max-contrast.md +9 -0
- package/docs-llm/dsl/formatters/multi-format-examples-json.md +67 -0
- package/docs-llm/dsl/formatters/multi-format-examples-react.md +49 -0
- package/docs-llm/dsl/formatters/multi-format.md +12 -0
- package/docs-llm/dsl/formatters/objects-examples-json.md +49 -0
- package/docs-llm/dsl/formatters/objects-examples-react.md +37 -0
- package/docs-llm/dsl/formatters/objects.md +3 -0
- package/docs-llm/dsl/formatters/pick-examples-json.md +59 -0
- package/docs-llm/dsl/formatters/pick-examples-react.md +30 -0
- package/docs-llm/dsl/formatters/pick.md +9 -0
- package/docs-llm/dsl/formatters/prefix-examples-json.md +29 -0
- package/docs-llm/dsl/formatters/prefix-examples-react.md +19 -0
- package/docs-llm/dsl/formatters/prefix.md +3 -0
- package/docs-llm/dsl/formatters/prepend-examples-json.md +51 -0
- package/docs-llm/dsl/formatters/prepend-examples-react.md +33 -0
- package/docs-llm/dsl/formatters/prepend.md +9 -0
- package/docs-llm/dsl/formatters/range-value-examples-json.md +48 -0
- package/docs-llm/dsl/formatters/range-value-examples-react.md +34 -0
- package/docs-llm/dsl/formatters/range-value.md +15 -0
- package/docs-llm/dsl/formatters/set-color-channel-examples-json.md +40 -0
- package/docs-llm/dsl/formatters/set-color-channel-examples-react.md +31 -0
- package/docs-llm/dsl/formatters/set-color-channel.md +9 -0
- package/docs-llm/dsl/formatters/suffix-examples-json.md +29 -0
- package/docs-llm/dsl/formatters/suffix-examples-react.md +19 -0
- package/docs-llm/dsl/formatters/suffix.md +3 -0
- package/docs-llm/dsl/formatters/type-examples-json.md +37 -0
- package/docs-llm/dsl/formatters/type-examples-react.md +20 -0
- package/docs-llm/dsl/formatters/type.md +3 -0
- package/docs-llm/dsl/overview.md +41 -0
- package/docs-llm/dsl/selectors/abs.md +7 -0
- package/docs-llm/dsl/selectors/ceil.md +7 -0
- package/docs-llm/dsl/selectors/data-frame-average-examples-json.md +41 -0
- package/docs-llm/dsl/selectors/data-frame-average-examples-react.md +36 -0
- package/docs-llm/dsl/selectors/data-frame-average.md +7 -0
- package/docs-llm/dsl/selectors/data-frame-count-examples-json.md +41 -0
- package/docs-llm/dsl/selectors/data-frame-count-examples-react.md +36 -0
- package/docs-llm/dsl/selectors/data-frame-count.md +7 -0
- package/docs-llm/dsl/selectors/data-frame-examples-json.md +830 -0
- package/docs-llm/dsl/selectors/data-frame-examples-react.md +929 -0
- package/docs-llm/dsl/selectors/data-frame-get-field-examples-json.md +89 -0
- package/docs-llm/dsl/selectors/data-frame-get-field-examples-react.md +124 -0
- package/docs-llm/dsl/selectors/data-frame-get-field.md +5 -0
- package/docs-llm/dsl/selectors/data-frame-get-raw-value.md +5 -0
- package/docs-llm/dsl/selectors/data-frame-get-type.md +5 -0
- package/docs-llm/dsl/selectors/data-frame-get-value.md +5 -0
- package/docs-llm/dsl/selectors/data-frame-max-examples-json.md +51 -0
- package/docs-llm/dsl/selectors/data-frame-max-examples-react.md +41 -0
- package/docs-llm/dsl/selectors/data-frame-max.md +7 -0
- package/docs-llm/dsl/selectors/data-frame-min-examples-json.md +51 -0
- package/docs-llm/dsl/selectors/data-frame-min-examples-react.md +41 -0
- package/docs-llm/dsl/selectors/data-frame-min.md +7 -0
- package/docs-llm/dsl/selectors/data-frame-percentile-examples-json.md +41 -0
- package/docs-llm/dsl/selectors/data-frame-percentile-examples-react.md +36 -0
- package/docs-llm/dsl/selectors/data-frame-percentile.md +8 -0
- package/docs-llm/dsl/selectors/data-frame-set-value.md +5 -0
- package/docs-llm/dsl/selectors/data-frame-sum-examples-json.md +51 -0
- package/docs-llm/dsl/selectors/data-frame-sum-examples-react.md +41 -0
- package/docs-llm/dsl/selectors/data-frame-sum.md +7 -0
- package/docs-llm/dsl/selectors/data-frame.md +4 -0
- package/docs-llm/dsl/selectors/data-point-get-field.md +5 -0
- package/docs-llm/dsl/selectors/data-point-get-raw-value.md +4 -0
- package/docs-llm/dsl/selectors/data-point-get-type.md +5 -0
- package/docs-llm/dsl/selectors/data-point-get-value.md +5 -0
- package/docs-llm/dsl/selectors/data-point-set-value.md +4 -0
- package/docs-llm/dsl/selectors/data-point.md +5 -0
- package/docs-llm/dsl/selectors/data-series-average.md +22 -0
- package/docs-llm/dsl/selectors/data-series-count.md +14 -0
- package/docs-llm/dsl/selectors/data-series-get-field.md +5 -0
- package/docs-llm/dsl/selectors/data-series-get-raw-value.md +4 -0
- package/docs-llm/dsl/selectors/data-series-get-type.md +5 -0
- package/docs-llm/dsl/selectors/data-series-get-value.md +4 -0
- package/docs-llm/dsl/selectors/data-series-max.md +5 -0
- package/docs-llm/dsl/selectors/data-series-min.md +5 -0
- package/docs-llm/dsl/selectors/data-series-percentile.md +17 -0
- package/docs-llm/dsl/selectors/data-series-set-value.md +4 -0
- package/docs-llm/dsl/selectors/data-series-sum.md +24 -0
- package/docs-llm/dsl/selectors/data-series.md +4 -0
- package/docs-llm/dsl/selectors/delta.md +7 -0
- package/docs-llm/dsl/selectors/divide.md +8 -0
- package/docs-llm/dsl/selectors/first-point.md +5 -0
- package/docs-llm/dsl/selectors/floor.md +7 -0
- package/docs-llm/dsl/selectors/frame-by-series-index-range-examples-json.md +89 -0
- package/docs-llm/dsl/selectors/frame-by-series-index-range-examples-react.md +88 -0
- package/docs-llm/dsl/selectors/frame-by-series-index-range.md +10 -0
- package/docs-llm/dsl/selectors/frame-by-series-indexes-examples-json.md +88 -0
- package/docs-llm/dsl/selectors/frame-by-series-indexes-examples-react.md +87 -0
- package/docs-llm/dsl/selectors/frame-by-series-indexes.md +9 -0
- package/docs-llm/dsl/selectors/frame-by-series-names-examples-json.md +89 -0
- package/docs-llm/dsl/selectors/frame-by-series-names-examples-react.md +88 -0
- package/docs-llm/dsl/selectors/frame-by-series-names-or-indexes-examples-json.md +89 -0
- package/docs-llm/dsl/selectors/frame-by-series-names-or-indexes-examples-react.md +88 -0
- package/docs-llm/dsl/selectors/frame-by-series-names-or-indexes.md +9 -0
- package/docs-llm/dsl/selectors/frame-by-series-names.md +9 -0
- package/docs-llm/dsl/selectors/frame-by-series-types-examples-json.md +89 -0
- package/docs-llm/dsl/selectors/frame-by-series-types-examples-react.md +88 -0
- package/docs-llm/dsl/selectors/frame-by-series-types.md +9 -0
- package/docs-llm/dsl/selectors/frame-without-internal-fields-examples-json.md +137 -0
- package/docs-llm/dsl/selectors/frame-without-internal-fields-examples-react.md +135 -0
- package/docs-llm/dsl/selectors/frame-without-internal-fields-except-examples-json.md +157 -0
- package/docs-llm/dsl/selectors/frame-without-internal-fields-except-examples-react.md +155 -0
- package/docs-llm/dsl/selectors/frame-without-internal-fields-except.md +21 -0
- package/docs-llm/dsl/selectors/frame-without-internal-fields.md +17 -0
- package/docs-llm/dsl/selectors/frame-without-series-names.md +8 -0
- package/docs-llm/dsl/selectors/last-point.md +5 -0
- package/docs-llm/dsl/selectors/minus.md +8 -0
- package/docs-llm/dsl/selectors/multiply.md +8 -0
- package/docs-llm/dsl/selectors/plus.md +8 -0
- package/docs-llm/dsl/selectors/point-by-index.md +6 -0
- package/docs-llm/dsl/selectors/points-by-indexes.md +6 -0
- package/docs-llm/dsl/selectors/round.md +7 -0
- package/docs-llm/dsl/selectors/series-by-index-examples-json.md +49 -0
- package/docs-llm/dsl/selectors/series-by-index-examples-react.md +39 -0
- package/docs-llm/dsl/selectors/series-by-index.md +8 -0
- package/docs-llm/dsl/selectors/series-by-name-examples-json.md +49 -0
- package/docs-llm/dsl/selectors/series-by-name-examples-react.md +39 -0
- package/docs-llm/dsl/selectors/series-by-name.md +8 -0
- package/docs-llm/dsl/selectors/series-by-prioritized-types-examples-json.md +47 -0
- package/docs-llm/dsl/selectors/series-by-prioritized-types-examples-react.md +39 -0
- package/docs-llm/dsl/selectors/series-by-prioritized-types.md +10 -0
- package/docs-llm/dsl/selectors/series-by-type-examples-json.md +49 -0
- package/docs-llm/dsl/selectors/series-by-type-examples-react.md +39 -0
- package/docs-llm/dsl/selectors/series-by-type.md +10 -0
- package/docs-llm/dsl/selectors/series-by-types.md +6 -0
- package/docs-llm/ellipse/examples-json.md +5 -0
- package/docs-llm/ellipse/examples-react.md +5 -0
- package/docs-llm/ellipse/options.md +16 -0
- package/docs-llm/ellipse/overview.md +5 -0
- package/docs-llm/events/examples-json.md +705 -0
- package/docs-llm/events/examples-react.md +536 -0
- package/docs-llm/events/options.md +18 -0
- package/docs-llm/events/overview.md +5 -0
- package/docs-llm/filler-gauge/examples-json.md +376 -0
- package/docs-llm/filler-gauge/examples-react.md +274 -0
- package/docs-llm/filler-gauge/options.md +26 -0
- package/docs-llm/filler-gauge/overview.md +5 -0
- package/docs-llm/image/examples-json.md +39 -0
- package/docs-llm/image/examples-react.md +65 -0
- package/docs-llm/image/options.md +13 -0
- package/docs-llm/image/overview.md +5 -0
- package/docs-llm/line/examples-json.md +3724 -0
- package/docs-llm/line/examples-react.md +2683 -0
- package/docs-llm/line/options.md +95 -0
- package/docs-llm/line/overview.md +29 -0
- package/docs-llm/link-graph/examples-json.md +5 -0
- package/docs-llm/link-graph/examples-react.md +5 -0
- package/docs-llm/link-graph/options.md +26 -0
- package/docs-llm/link-graph/overview.md +16 -0
- package/docs-llm/map/examples-json.md +13973 -0
- package/docs-llm/map/examples-react.md +6154 -0
- package/docs-llm/map/options.md +22 -0
- package/docs-llm/map/overview.md +32 -0
- package/docs-llm/markdown/examples-json.md +63 -0
- package/docs-llm/markdown/examples-react.md +98 -0
- package/docs-llm/markdown/options.md +17 -0
- package/docs-llm/markdown/overview.md +5 -0
- package/docs-llm/marker-gauge/examples-json.md +436 -0
- package/docs-llm/marker-gauge/examples-react.md +367 -0
- package/docs-llm/marker-gauge/options.md +26 -0
- package/docs-llm/marker-gauge/overview.md +5 -0
- package/docs-llm/network-graph/examples-json.md +8843 -0
- package/docs-llm/network-graph/examples-react.md +7339 -0
- package/docs-llm/network-graph/options.md +50 -0
- package/docs-llm/network-graph/overview.md +28 -0
- package/docs-llm/parallel-coordinates/examples-json.md +8376 -0
- package/docs-llm/parallel-coordinates/examples-react.md +2771 -0
- package/docs-llm/parallel-coordinates/options.md +14 -0
- package/docs-llm/parallel-coordinates/overview.md +22 -0
- package/docs-llm/pie/examples-json.md +851 -0
- package/docs-llm/pie/examples-react.md +606 -0
- package/docs-llm/pie/options.md +34 -0
- package/docs-llm/pie/overview.md +23 -0
- package/docs-llm/process-tree/options.md +32 -0
- package/docs-llm/punchcard/examples-json.md +6134 -0
- package/docs-llm/punchcard/examples-react.md +4562 -0
- package/docs-llm/punchcard/options.md +33 -0
- package/docs-llm/punchcard/overview.md +5 -0
- package/docs-llm/pure-rich-text/options.md +28 -0
- package/docs-llm/rectangle/examples-json.md +5 -0
- package/docs-llm/rectangle/examples-react.md +5 -0
- package/docs-llm/rectangle/options.md +19 -0
- package/docs-llm/rectangle/overview.md +5 -0
- package/docs-llm/rich-text/examples-json.md +96 -0
- package/docs-llm/rich-text/examples-react.md +119 -0
- package/docs-llm/rich-text/options.md +28 -0
- package/docs-llm/rich-text/overview.md +5 -0
- package/docs-llm/sankey/examples-json.md +844 -0
- package/docs-llm/sankey/examples-react.md +546 -0
- package/docs-llm/sankey/options.md +19 -0
- package/docs-llm/sankey/overview.md +24 -0
- package/docs-llm/scatter/examples-json.md +4012 -0
- package/docs-llm/scatter/examples-react.md +3914 -0
- package/docs-llm/scatter/options.md +68 -0
- package/docs-llm/scatter/overview.md +25 -0
- package/docs-llm/single-value/examples-json.md +2613 -0
- package/docs-llm/single-value/examples-react.md +2296 -0
- package/docs-llm/single-value/options.md +49 -0
- package/docs-llm/single-value/overview.md +23 -0
- package/docs-llm/single-value-icon/examples-json.md +1686 -0
- package/docs-llm/single-value-icon/examples-react.md +1573 -0
- package/docs-llm/single-value-icon/options.md +43 -0
- package/docs-llm/single-value-icon/overview.md +5 -0
- package/docs-llm/single-value-radial/examples-json.md +1178 -0
- package/docs-llm/single-value-radial/examples-react.md +1028 -0
- package/docs-llm/single-value-radial/options.md +41 -0
- package/docs-llm/single-value-radial/overview.md +5 -0
- package/docs-llm/table/examples-json.md +5 -0
- package/docs-llm/table/examples-react.md +5 -0
- package/docs-llm/table/options.md +25 -0
- package/docs-llm/table/overview.md +24 -0
- package/docs-llm/timeline/examples-json.md +5 -0
- package/docs-llm/timeline/examples-react.md +5 -0
- package/docs-llm/timeline/options.md +27 -0
- package/docs-llm/timeline/overview.md +24 -0
- package/package.json +39 -30
- package/LICENSE.md +0 -449
package/SingleValue.js
CHANGED
|
@@ -12,6 +12,7 @@ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
12
12
|
var __getProtoOf = Object.getPrototypeOf;
|
|
13
13
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
14
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
15
|
+
var __pow = Math.pow;
|
|
15
16
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
16
17
|
var __spreadValues = (a, b) => {
|
|
17
18
|
for (var prop in b || (b = {}))
|
|
@@ -196,8 +197,27 @@ var TrellisTitleDiv = styled_components_default.div`
|
|
|
196
197
|
background-color: ${(props) => props.backgroundColor};
|
|
197
198
|
box-shadow: 0 1px ${(props) => props.backgroundColor}; // this is added to avoid a 1px gap between title and viz divs that showed up intermittently because of pixel rounding error in chrome.
|
|
198
199
|
`;
|
|
200
|
+
var formatTrellisKey = (value) => {
|
|
201
|
+
if (value === null || value === void 0) {
|
|
202
|
+
return "";
|
|
203
|
+
}
|
|
204
|
+
if (typeof value === "string") {
|
|
205
|
+
return value;
|
|
206
|
+
}
|
|
207
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
208
|
+
return value.toString();
|
|
209
|
+
}
|
|
210
|
+
if (typeof value === "symbol") {
|
|
211
|
+
return value.toString();
|
|
212
|
+
}
|
|
213
|
+
try {
|
|
214
|
+
return JSON.stringify(value);
|
|
215
|
+
} catch (e) {
|
|
216
|
+
return typeof value === "bigint" ? value.toString() : "";
|
|
217
|
+
}
|
|
218
|
+
};
|
|
199
219
|
var TrellisTitle = (props) => {
|
|
200
|
-
const titleText =
|
|
220
|
+
const titleText = formatTrellisKey(props.trellisKey);
|
|
201
221
|
return /* @__PURE__ */ react_exports.createElement(
|
|
202
222
|
TrellisTitleDiv,
|
|
203
223
|
{
|
|
@@ -327,7 +347,7 @@ var computeColors = (props, defaultColors) => {
|
|
|
327
347
|
trendDisplay: props.trendDisplay,
|
|
328
348
|
defaultColors
|
|
329
349
|
});
|
|
330
|
-
const underLabelColor = majorColor;
|
|
350
|
+
const underLabelColor = getFormattedColor(props.underLabelColor, majorColor);
|
|
331
351
|
return {
|
|
332
352
|
backgroundColor,
|
|
333
353
|
backgroundEnabled,
|
|
@@ -614,6 +634,15 @@ var adjustRGB = (rgb, delta) => {
|
|
|
614
634
|
}
|
|
615
635
|
return rgb;
|
|
616
636
|
};
|
|
637
|
+
var getUnchangedColorDelta = (r, g, b, ratio) => {
|
|
638
|
+
if (r === 0 && g === 0 && b === 0) {
|
|
639
|
+
return ratio > 1 ? 80 : 40;
|
|
640
|
+
}
|
|
641
|
+
if (r === 255 && g === 255 && b === 255) {
|
|
642
|
+
return ratio > 1 ? 20 : 80;
|
|
643
|
+
}
|
|
644
|
+
return 20;
|
|
645
|
+
};
|
|
617
646
|
var changeColor = (color, ratio) => {
|
|
618
647
|
const hex = color.replace(/(0x|#)/, "");
|
|
619
648
|
const r = parseInt(hex.substr(0, 2), 16);
|
|
@@ -623,31 +652,10 @@ var changeColor = (color, ratio) => {
|
|
|
623
652
|
let newG = Math.max(Math.min(Math.floor(g * ratio), 255), 0);
|
|
624
653
|
let newB = Math.max(Math.min(Math.floor(b * ratio), 255), 0);
|
|
625
654
|
if (newR === r && newG === g && newB === b) {
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
newB = adjustRGB(newB, 80);
|
|
631
|
-
} else {
|
|
632
|
-
newR = adjustRGB(newR, 40);
|
|
633
|
-
newG = adjustRGB(newG, 40);
|
|
634
|
-
newB = adjustRGB(newB, 40);
|
|
635
|
-
}
|
|
636
|
-
} else if (newR === 255 && newG === 255 && newB === 255) {
|
|
637
|
-
if (ratio > 1) {
|
|
638
|
-
newR = adjustRGB(newR, 20);
|
|
639
|
-
newG = adjustRGB(newG, 20);
|
|
640
|
-
newB = adjustRGB(newB, 20);
|
|
641
|
-
} else {
|
|
642
|
-
newR = adjustRGB(newR, 80);
|
|
643
|
-
newG = adjustRGB(newG, 80);
|
|
644
|
-
newB = adjustRGB(newB, 80);
|
|
645
|
-
}
|
|
646
|
-
} else {
|
|
647
|
-
newR = adjustRGB(newR, 20);
|
|
648
|
-
newG = adjustRGB(newG, 20);
|
|
649
|
-
newB = adjustRGB(newB, 20);
|
|
650
|
-
}
|
|
655
|
+
const delta = getUnchangedColorDelta(newR, newG, newB, ratio);
|
|
656
|
+
newR = adjustRGB(newR, delta);
|
|
657
|
+
newG = adjustRGB(newG, delta);
|
|
658
|
+
newB = adjustRGB(newB, delta);
|
|
651
659
|
}
|
|
652
660
|
return `#${newR.toString(16).padStart(2, 0)}${newG.toString(16).padStart(2, 0)}${newB.toString(16).padStart(2, 0)}`;
|
|
653
661
|
};
|
|
@@ -970,7 +978,7 @@ var defaultImport20 = __toESM(require("@splunk/ui-utils/id"));
|
|
|
970
978
|
__reExport(id_exports, require("@splunk/ui-utils/id"));
|
|
971
979
|
var id_default = "default" in defaultImport20 ? defaultImport20.default : defaultImport20;
|
|
972
980
|
|
|
973
|
-
// src/SparkLine/SparkLine.
|
|
981
|
+
// src/SparkLine/SparkLine.tsx
|
|
974
982
|
var StyledSvg = styled_components_default.svg`
|
|
975
983
|
/* For fixing IE11 shows overflow part line issue */
|
|
976
984
|
overflow: hidden;
|
|
@@ -982,233 +990,262 @@ var StyledTooltip = styled_components_default.div`
|
|
|
982
990
|
min-width: 20px;
|
|
983
991
|
`;
|
|
984
992
|
var preventDefault = (e) => e.preventDefault();
|
|
985
|
-
var
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
993
|
+
var PROP_KEYS = [
|
|
994
|
+
"acceptNull",
|
|
995
|
+
"data",
|
|
996
|
+
"elementRef",
|
|
997
|
+
"endDotCount",
|
|
998
|
+
"endDotFillColor",
|
|
999
|
+
"endDotRadius",
|
|
1000
|
+
"endDotStroke",
|
|
1001
|
+
"endDotStrokeWidth",
|
|
1002
|
+
"fillColor",
|
|
1003
|
+
"fillOpacity",
|
|
1004
|
+
"cursorStroke",
|
|
1005
|
+
"cursorStrokeWidth",
|
|
1006
|
+
"cursorStrokeLinecap",
|
|
1007
|
+
"cursorStrokeDasharray",
|
|
1008
|
+
"height",
|
|
1009
|
+
"isArea",
|
|
1010
|
+
"lineColor",
|
|
1011
|
+
"lineLength",
|
|
1012
|
+
"lineStrokeWidth",
|
|
1013
|
+
"showEndDot",
|
|
1014
|
+
"showTooltip",
|
|
1015
|
+
"yMax",
|
|
1016
|
+
"yMin",
|
|
1017
|
+
"width",
|
|
1018
|
+
"title"
|
|
1019
|
+
];
|
|
1020
|
+
var SparkLineInner = (_a) => {
|
|
1021
|
+
var _b = _a, {
|
|
1022
|
+
acceptNull = false,
|
|
1023
|
+
data = [],
|
|
1024
|
+
elementRef,
|
|
1025
|
+
endDotCount = 0,
|
|
1026
|
+
endDotFillColor = "white",
|
|
1027
|
+
endDotRadius = 0,
|
|
1028
|
+
endDotStroke = "black",
|
|
1029
|
+
endDotStrokeWidth = 0,
|
|
1030
|
+
fillColor = "#65a637",
|
|
1031
|
+
fillOpacity = ".1",
|
|
1032
|
+
cursorStroke = "#5184AF",
|
|
1033
|
+
cursorStrokeWidth = 3,
|
|
1034
|
+
cursorStrokeLinecap = "square",
|
|
1035
|
+
cursorStrokeDasharray = "1, 5",
|
|
1036
|
+
height,
|
|
1037
|
+
isArea = false,
|
|
1038
|
+
lineColor = "#65a637",
|
|
1039
|
+
lineLength,
|
|
1040
|
+
lineStrokeWidth = 1,
|
|
1041
|
+
showEndDot = false,
|
|
1042
|
+
showTooltip = true,
|
|
1043
|
+
yMax,
|
|
1044
|
+
yMin,
|
|
1045
|
+
width,
|
|
1046
|
+
title
|
|
1047
|
+
} = _b, restProps = __objRest(_b, [
|
|
1048
|
+
"acceptNull",
|
|
1049
|
+
"data",
|
|
1050
|
+
"elementRef",
|
|
1051
|
+
"endDotCount",
|
|
1052
|
+
"endDotFillColor",
|
|
1053
|
+
"endDotRadius",
|
|
1054
|
+
"endDotStroke",
|
|
1055
|
+
"endDotStrokeWidth",
|
|
1056
|
+
"fillColor",
|
|
1057
|
+
"fillOpacity",
|
|
1058
|
+
"cursorStroke",
|
|
1059
|
+
"cursorStrokeWidth",
|
|
1060
|
+
"cursorStrokeLinecap",
|
|
1061
|
+
"cursorStrokeDasharray",
|
|
1062
|
+
"height",
|
|
1063
|
+
"isArea",
|
|
1064
|
+
"lineColor",
|
|
1065
|
+
"lineLength",
|
|
1066
|
+
"lineStrokeWidth",
|
|
1067
|
+
"showEndDot",
|
|
1068
|
+
"showTooltip",
|
|
1069
|
+
"yMax",
|
|
1070
|
+
"yMin",
|
|
1071
|
+
"width",
|
|
1072
|
+
"title"
|
|
1073
|
+
]);
|
|
1074
|
+
const [anchor, setAnchor] = (0, react_exports.useState)(null);
|
|
1075
|
+
const [activeIndex, setActiveIndex] = (0, react_exports.useState)(0);
|
|
1076
|
+
const [hoveredIndex, setHoveredIndex] = (0, react_exports.useState)(null);
|
|
1077
|
+
const [componentIsFocused, setComponentIsFocused] = (0, react_exports.useState)(false);
|
|
1078
|
+
const titleId = (0, react_exports.useMemo)(() => (0, id_exports.createDOMID)("sparkline-title"), []);
|
|
1079
|
+
const pointRefs = (0, react_exports.useRef)([]);
|
|
1080
|
+
const containerRef = (0, react_exports.useRef)(null);
|
|
1081
|
+
const fillNull = (0, react_exports.useCallback)(() => data.map((value) => value != null ? value : 0), [data]);
|
|
1082
|
+
const getMax = (0, react_exports.useCallback)(() => {
|
|
1083
|
+
const dataMax = () => acceptNull ? (0, lodash_exports.max)(fillNull()) : (0, lodash_exports.max)(data);
|
|
1084
|
+
return yMax != null ? yMax : dataMax();
|
|
1085
|
+
}, [acceptNull, data, fillNull, yMax]);
|
|
1086
|
+
const getMin = (0, react_exports.useCallback)(() => {
|
|
1087
|
+
const dataMin = () => acceptNull ? (0, lodash_exports.min)(fillNull()) : (0, lodash_exports.min)(data);
|
|
1088
|
+
return yMin != null ? yMin : dataMin();
|
|
1089
|
+
}, [acceptNull, data, fillNull, yMin]);
|
|
1090
|
+
const getXUnit = (0, react_exports.useCallback)(
|
|
1091
|
+
(xMargin2) => {
|
|
1092
|
+
const xUnit = (width - xMargin2 * 2) / (data.length > 1 ? data.length - 1 : 1);
|
|
1093
|
+
return Math.max(0, xUnit);
|
|
1094
|
+
},
|
|
1095
|
+
[data.length, width]
|
|
1096
|
+
);
|
|
1097
|
+
const getYUnit = (0, react_exports.useCallback)(
|
|
1098
|
+
(yMargin2) => {
|
|
1099
|
+
const maxValue = getMax();
|
|
1100
|
+
const minValue = getMin();
|
|
1101
|
+
const yUnit = (height - yMargin2 * 2) / (maxValue - minValue || 2);
|
|
1102
|
+
return Math.max(0, yUnit);
|
|
1103
|
+
},
|
|
1104
|
+
[getMax, getMin, height]
|
|
1105
|
+
);
|
|
1106
|
+
const getSegmentSets = (0, react_exports.useCallback)(
|
|
1107
|
+
(segmentData, points2) => {
|
|
1108
|
+
const lines = [];
|
|
1109
|
+
const isolatedPoints = [];
|
|
1110
|
+
let currentLine = [];
|
|
1111
|
+
for (const [idx, p] of segmentData.entries()) {
|
|
1112
|
+
if (!acceptNull && (0, lodash_exports.isNull)(p)) {
|
|
1113
|
+
if (currentLine.length > 1) {
|
|
1114
|
+
lines.push(currentLine);
|
|
1115
|
+
} else if (currentLine.length === 1) {
|
|
1116
|
+
isolatedPoints.push(currentLine[0]);
|
|
1117
|
+
}
|
|
1118
|
+
currentLine = [];
|
|
1119
|
+
} else {
|
|
1120
|
+
currentLine.push(points2[idx]);
|
|
1121
|
+
}
|
|
1020
1122
|
}
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
return
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1123
|
+
if (currentLine.length > 1) {
|
|
1124
|
+
lines.push(currentLine);
|
|
1125
|
+
} else if (currentLine.length === 1) {
|
|
1126
|
+
isolatedPoints.push(currentLine[0]);
|
|
1127
|
+
}
|
|
1128
|
+
return { lines, isolatedPoints };
|
|
1129
|
+
},
|
|
1130
|
+
[acceptNull]
|
|
1131
|
+
);
|
|
1132
|
+
const dataToPoints = (0, react_exports.useCallback)(
|
|
1133
|
+
(xMargin2, yMargin2) => {
|
|
1134
|
+
const xUnit = getXUnit(xMargin2);
|
|
1135
|
+
const yUnit = getYUnit(yMargin2);
|
|
1136
|
+
const maxValue = getMax();
|
|
1137
|
+
const minValue = getMin();
|
|
1138
|
+
return data.map((val, idx) => ({
|
|
1139
|
+
x: idx * xUnit + xMargin2,
|
|
1140
|
+
y: maxValue === minValue ? yUnit + yMargin2 : (maxValue - val) * yUnit + yMargin2
|
|
1141
|
+
})).map((p) => [p.x, p.y]);
|
|
1142
|
+
},
|
|
1143
|
+
[data, getMax, getMin, getXUnit, getYUnit]
|
|
1144
|
+
);
|
|
1145
|
+
const handleFocus = (0, react_exports.useCallback)(
|
|
1146
|
+
(event) => {
|
|
1147
|
+
const { target } = event;
|
|
1148
|
+
const { pointIndex: pointIndexStr } = target.dataset || {};
|
|
1149
|
+
if (pointIndexStr !== void 0) {
|
|
1150
|
+
const pointIndex = Number.parseInt(pointIndexStr, 10);
|
|
1151
|
+
if (activeIndex !== pointIndex || !componentIsFocused || hoveredIndex !== null) {
|
|
1152
|
+
setActiveIndex(pointIndex);
|
|
1153
|
+
setHoveredIndex(null);
|
|
1154
|
+
setComponentIsFocused(true);
|
|
1155
|
+
}
|
|
1156
|
+
} else if (pointRefs.current.length > 0) {
|
|
1157
|
+
const indexToFocus = activeIndex ? Math.min(pointRefs.current.length - 1, activeIndex) : 0;
|
|
1158
|
+
pointRefs.current[indexToFocus].focus();
|
|
1159
|
+
}
|
|
1160
|
+
},
|
|
1161
|
+
[activeIndex, componentIsFocused, hoveredIndex]
|
|
1162
|
+
);
|
|
1163
|
+
const handleBlur = (0, react_exports.useCallback)((event) => {
|
|
1164
|
+
if (containerRef.current && !containerRef.current.contains(event.relatedTarget)) {
|
|
1165
|
+
setComponentIsFocused(false);
|
|
1041
1166
|
}
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1167
|
+
}, []);
|
|
1168
|
+
const handleKeyDown = (0, react_exports.useCallback)(
|
|
1169
|
+
(event) => {
|
|
1170
|
+
const numPoints = data.length;
|
|
1171
|
+
const allowedKeys = ["ArrowLeft", "ArrowRight", "Home", "End"];
|
|
1172
|
+
if (!allowedKeys.includes(event.key)) {
|
|
1173
|
+
return;
|
|
1174
|
+
}
|
|
1175
|
+
let newIndex;
|
|
1176
|
+
if (event.key === "Home") {
|
|
1045
1177
|
newIndex = 0;
|
|
1046
|
-
|
|
1047
|
-
case "End":
|
|
1178
|
+
} else if (event.key === "End") {
|
|
1048
1179
|
newIndex = numPoints - 1;
|
|
1049
|
-
|
|
1050
|
-
case "ArrowLeft":
|
|
1180
|
+
} else if (event.key === "ArrowLeft") {
|
|
1051
1181
|
newIndex = Math.max(0, activeIndex - 1);
|
|
1052
|
-
|
|
1053
|
-
case "ArrowRight":
|
|
1182
|
+
} else {
|
|
1054
1183
|
newIndex = Math.min(numPoints - 1, activeIndex + 1);
|
|
1055
|
-
break;
|
|
1056
|
-
default:
|
|
1057
|
-
return;
|
|
1058
|
-
}
|
|
1059
|
-
if (newIndex !== activeIndex) {
|
|
1060
|
-
event.preventDefault();
|
|
1061
|
-
if (this.pointRefs[newIndex]) {
|
|
1062
|
-
this.pointRefs[newIndex].focus();
|
|
1063
1184
|
}
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
const pointIndex = Number.parseInt(pointIndexStr, 10);
|
|
1070
|
-
if (this.state.hoveredIndex !== pointIndex) {
|
|
1071
|
-
this.setState({ hoveredIndex: pointIndex });
|
|
1185
|
+
if (newIndex !== activeIndex) {
|
|
1186
|
+
event.preventDefault();
|
|
1187
|
+
if (pointRefs.current[newIndex]) {
|
|
1188
|
+
pointRefs.current[newIndex].focus();
|
|
1189
|
+
}
|
|
1072
1190
|
}
|
|
1073
|
-
}
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
}
|
|
1085
|
-
getMin() {
|
|
1086
|
-
const { data, acceptNull, yMin } = this.props;
|
|
1087
|
-
const dataMin = () => acceptNull ? (0, lodash_exports.min)(this.fillNull()) : (0, lodash_exports.min)(data);
|
|
1088
|
-
return yMin === void 0 ? dataMin() : yMin;
|
|
1089
|
-
}
|
|
1090
|
-
/**
|
|
1091
|
-
* Gets unit value of x axis.
|
|
1092
|
-
* @param {Number} xMargin - margin of x axis.
|
|
1093
|
-
* @return {Number} unit value of x axis.
|
|
1094
|
-
* @private
|
|
1095
|
-
*/
|
|
1096
|
-
getXUnit(xMargin) {
|
|
1097
|
-
const { data, width } = this.props;
|
|
1098
|
-
const xUnit = (width - xMargin * 2) / (data.length > 1 ? data.length - 1 : 1);
|
|
1099
|
-
return Math.max(0, xUnit);
|
|
1100
|
-
}
|
|
1101
|
-
/**
|
|
1102
|
-
* Gets unit value of y axis.
|
|
1103
|
-
* @param {String} yMargin - margin of y axis.
|
|
1104
|
-
* @return {Number} unit value of y axis.
|
|
1105
|
-
* @private
|
|
1106
|
-
*/
|
|
1107
|
-
getYUnit(yMargin) {
|
|
1108
|
-
const { height } = this.props;
|
|
1109
|
-
const maxValue = this.getMax();
|
|
1110
|
-
const minValue = this.getMin();
|
|
1111
|
-
const yUnit = (height - yMargin * 2) / (maxValue - minValue || 2);
|
|
1112
|
-
return Math.max(0, yUnit);
|
|
1113
|
-
}
|
|
1114
|
-
/**
|
|
1115
|
-
* Get a list of arrays of points for drawing lines, based on acceptNull property
|
|
1116
|
-
* @method getSegmentSets
|
|
1117
|
-
* @param {Array} data
|
|
1118
|
-
* @param {Array} points
|
|
1119
|
-
* @returns {Object} Object containing lines (arrays of points for polylines) and isolatedPoints (single points surrounded by nulls)
|
|
1120
|
-
*/
|
|
1121
|
-
getSegmentSets(data, points) {
|
|
1122
|
-
const { acceptNull } = this.props;
|
|
1123
|
-
const lines = [];
|
|
1124
|
-
const isolatedPoints = [];
|
|
1125
|
-
let currentLine = [];
|
|
1126
|
-
for (const [idx, p] of data.entries()) {
|
|
1127
|
-
if (!acceptNull && (0, lodash_exports.isNull)(p)) {
|
|
1128
|
-
if (currentLine.length > 1) {
|
|
1129
|
-
lines.push(currentLine);
|
|
1130
|
-
} else if (currentLine.length === 1) {
|
|
1131
|
-
isolatedPoints.push(currentLine[0]);
|
|
1191
|
+
},
|
|
1192
|
+
[activeIndex, data.length]
|
|
1193
|
+
);
|
|
1194
|
+
const handleMouseOver = (0, react_exports.useCallback)(
|
|
1195
|
+
(event) => {
|
|
1196
|
+
var _a2;
|
|
1197
|
+
const pointIndexStr = (_a2 = event.target.dataset) == null ? void 0 : _a2.pointIndex;
|
|
1198
|
+
if (pointIndexStr !== void 0) {
|
|
1199
|
+
const pointIndex = Number.parseInt(pointIndexStr, 10);
|
|
1200
|
+
if (hoveredIndex !== pointIndex) {
|
|
1201
|
+
setHoveredIndex(pointIndex);
|
|
1132
1202
|
}
|
|
1133
|
-
currentLine = [];
|
|
1134
|
-
} else {
|
|
1135
|
-
currentLine.push(points[idx]);
|
|
1136
1203
|
}
|
|
1204
|
+
},
|
|
1205
|
+
[hoveredIndex]
|
|
1206
|
+
);
|
|
1207
|
+
const handleMouseLeave = (0, react_exports.useCallback)(() => {
|
|
1208
|
+
if (hoveredIndex !== null) {
|
|
1209
|
+
setHoveredIndex(null);
|
|
1137
1210
|
}
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
})
|
|
1170
|
-
}
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
* @param {Array} points - array of points coordination.
|
|
1174
|
-
* @param {Number} xMargin - margin of x axis.
|
|
1175
|
-
* @return {Array} array of svg rect objects
|
|
1176
|
-
* @private
|
|
1177
|
-
*/
|
|
1178
|
-
renderRect(points, xMargin) {
|
|
1179
|
-
const { data, height, showTooltip } = this.props;
|
|
1180
|
-
const xUnit = this.getXUnit(xMargin);
|
|
1181
|
-
return points.map((p, i) => (
|
|
1182
|
-
/* eslint-disable react/no-array-index-key */
|
|
1183
|
-
/* @__PURE__ */ react_default.createElement(
|
|
1184
|
-
"rect",
|
|
1185
|
-
{
|
|
1186
|
-
key: `${i}_${p[0]}`,
|
|
1187
|
-
role: "graphics-symbol",
|
|
1188
|
-
"aria-label": `Value: ${data[i] === null ? "N/A" : data[i]}, point ${i + 1} of ${data.length}`,
|
|
1189
|
-
"data-test": `rect-${i}`,
|
|
1190
|
-
"data-point-index": i,
|
|
1191
|
-
tabIndex: showTooltip && this.state.activeIndex === i ? 0 : -1,
|
|
1192
|
-
ref: (el) => {
|
|
1193
|
-
this.pointRefs[i] = el;
|
|
1194
|
-
},
|
|
1195
|
-
x: Math.max(0, p[0] - xUnit / 2),
|
|
1196
|
-
y: 0,
|
|
1197
|
-
width: i === 0 && data.length !== 1 ? xUnit / 2 : xUnit,
|
|
1198
|
-
height,
|
|
1199
|
-
style: { fillOpacity: 0 },
|
|
1200
|
-
onMouseDown: preventDefault
|
|
1201
|
-
}
|
|
1202
|
-
)
|
|
1203
|
-
));
|
|
1204
|
-
}
|
|
1205
|
-
// Renders area chart
|
|
1206
|
-
renderArea(points) {
|
|
1207
|
-
const { data, fillColor, fillOpacity, height, isArea } = this.props;
|
|
1208
|
-
if (!isArea || points.length === 0) {
|
|
1211
|
+
}, [hoveredIndex]);
|
|
1212
|
+
const handleCursorMount = (0, react_exports.useCallback)((el) => {
|
|
1213
|
+
setAnchor(el);
|
|
1214
|
+
}, []);
|
|
1215
|
+
const renderRect = (points2, xMargin2) => {
|
|
1216
|
+
const xUnit = getXUnit(xMargin2);
|
|
1217
|
+
return points2.map((p, i) => {
|
|
1218
|
+
var _a2;
|
|
1219
|
+
return (
|
|
1220
|
+
/* eslint-disable react/no-array-index-key */
|
|
1221
|
+
/* @__PURE__ */ react_default.createElement(
|
|
1222
|
+
"rect",
|
|
1223
|
+
{
|
|
1224
|
+
key: `${i}_${p[0]}`,
|
|
1225
|
+
role: "graphics-symbol",
|
|
1226
|
+
"aria-label": `Value: ${(_a2 = data[i]) != null ? _a2 : "N/A"}, point ${i + 1} of ${data.length}`,
|
|
1227
|
+
"data-test": `rect-${i}`,
|
|
1228
|
+
"data-point-index": i,
|
|
1229
|
+
tabIndex: showTooltip && activeIndex === i ? 0 : -1,
|
|
1230
|
+
ref: (el) => {
|
|
1231
|
+
pointRefs.current[i] = el;
|
|
1232
|
+
},
|
|
1233
|
+
x: Math.max(0, p[0] - xUnit / 2),
|
|
1234
|
+
y: 0,
|
|
1235
|
+
width: i === 0 && data.length !== 1 ? xUnit / 2 : xUnit,
|
|
1236
|
+
height,
|
|
1237
|
+
style: { fillOpacity: 0 },
|
|
1238
|
+
onMouseDown: preventDefault
|
|
1239
|
+
}
|
|
1240
|
+
)
|
|
1241
|
+
);
|
|
1242
|
+
});
|
|
1243
|
+
};
|
|
1244
|
+
const renderArea = (points2) => {
|
|
1245
|
+
if (!isArea || points2.length === 0) {
|
|
1209
1246
|
return null;
|
|
1210
1247
|
}
|
|
1211
|
-
const { lines } =
|
|
1248
|
+
const { lines } = getSegmentSets(data, points2);
|
|
1212
1249
|
const segments = lines.map(
|
|
1213
1250
|
(s) => s.concat([
|
|
1214
1251
|
[s.at(-1)[0], height],
|
|
@@ -1232,80 +1269,56 @@ var _SparkLine = class _SparkLine extends react_exports.Component {
|
|
|
1232
1269
|
}
|
|
1233
1270
|
}
|
|
1234
1271
|
)));
|
|
1235
|
-
}
|
|
1236
|
-
renderCursor(
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
"
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
strokeLinecap: cursorStrokeLinecap,
|
|
1251
|
-
strokeDasharray: cursorStrokeDasharray
|
|
1252
|
-
}
|
|
1272
|
+
};
|
|
1273
|
+
const renderCursor = (currentPointX2, shouldRender) => shouldRender && /* @__PURE__ */ react_default.createElement(
|
|
1274
|
+
"line",
|
|
1275
|
+
{
|
|
1276
|
+
"data-test": "cursor",
|
|
1277
|
+
ref: handleCursorMount,
|
|
1278
|
+
x1: currentPointX2,
|
|
1279
|
+
y1: 0,
|
|
1280
|
+
x2: currentPointX2,
|
|
1281
|
+
y2: height,
|
|
1282
|
+
style: {
|
|
1283
|
+
stroke: cursorStroke,
|
|
1284
|
+
strokeWidth: cursorStrokeWidth,
|
|
1285
|
+
strokeLinecap: cursorStrokeLinecap,
|
|
1286
|
+
strokeDasharray: cursorStrokeDasharray
|
|
1253
1287
|
}
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
renderTooltip(
|
|
1257
|
-
const
|
|
1258
|
-
const displayValue = tooltipValue === null ? "-" : tooltipValue;
|
|
1288
|
+
}
|
|
1289
|
+
);
|
|
1290
|
+
const renderTooltip = (tooltipValue2, isOpen) => {
|
|
1291
|
+
const displayValue = tooltipValue2 === null ? "-" : tooltipValue2;
|
|
1259
1292
|
return /* @__PURE__ */ react_default.createElement(
|
|
1260
1293
|
Popover_default,
|
|
1261
1294
|
{
|
|
1262
1295
|
"data-test": "tooltip",
|
|
1263
1296
|
open: isOpen,
|
|
1264
1297
|
anchor,
|
|
1265
|
-
"data-test-value":
|
|
1298
|
+
"data-test-value": tooltipValue2,
|
|
1266
1299
|
appearance: "inverted",
|
|
1267
1300
|
defaultPlacement: "above",
|
|
1268
1301
|
animation: false
|
|
1269
1302
|
},
|
|
1270
1303
|
/* @__PURE__ */ react_default.createElement(StyledTooltip, null, displayValue)
|
|
1271
1304
|
);
|
|
1272
|
-
}
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
"circle",
|
|
1286
|
-
{
|
|
1287
|
-
key: `end-dot${point[0]}${point[1]}`,
|
|
1288
|
-
"data-test": "end-dot",
|
|
1289
|
-
cx: point[0],
|
|
1290
|
-
cy: point[1],
|
|
1291
|
-
r: endDotRadius === 0 ? xMargin : endDotRadius,
|
|
1292
|
-
style: {
|
|
1293
|
-
fill: endDotFillColor,
|
|
1294
|
-
stroke: endDotStroke,
|
|
1295
|
-
strokeWidth: endDotStrokeWidth
|
|
1296
|
-
}
|
|
1305
|
+
};
|
|
1306
|
+
const renderEndDots = (points2, dotsToShow2, xMargin2) => /* @__PURE__ */ react_default.createElement("g", null, points2.slice(-dotsToShow2).map((point) => /* @__PURE__ */ react_default.createElement(
|
|
1307
|
+
"circle",
|
|
1308
|
+
{
|
|
1309
|
+
key: `end-dot${point[0]}${point[1]}`,
|
|
1310
|
+
"data-test": "end-dot",
|
|
1311
|
+
cx: point[0],
|
|
1312
|
+
cy: point[1],
|
|
1313
|
+
r: endDotRadius === 0 ? xMargin2 : endDotRadius,
|
|
1314
|
+
style: {
|
|
1315
|
+
fill: endDotFillColor,
|
|
1316
|
+
stroke: endDotStroke,
|
|
1317
|
+
strokeWidth: endDotStrokeWidth
|
|
1297
1318
|
}
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
* Renders circles for isolated points (single data points surrounded by nulls)
|
|
1302
|
-
* These would otherwise be invisible since a line requires at least 2 points
|
|
1303
|
-
* @method renderIsolatedPoints
|
|
1304
|
-
* @param {Array} isolatedPoints - Array of [x, y] coordinates for isolated points
|
|
1305
|
-
* @returns {Object} SVG Group of circles
|
|
1306
|
-
*/
|
|
1307
|
-
renderIsolatedPoints(isolatedPoints) {
|
|
1308
|
-
const { lineColor, lineStrokeWidth } = this.props;
|
|
1319
|
+
}
|
|
1320
|
+
)));
|
|
1321
|
+
const renderIsolatedPoints = (isolatedPoints) => {
|
|
1309
1322
|
if (!isolatedPoints || isolatedPoints.length === 0) {
|
|
1310
1323
|
return null;
|
|
1311
1324
|
}
|
|
@@ -1323,20 +1336,10 @@ var _SparkLine = class _SparkLine extends react_exports.Component {
|
|
|
1323
1336
|
}
|
|
1324
1337
|
}
|
|
1325
1338
|
)));
|
|
1326
|
-
}
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
* @param {Array} points
|
|
1331
|
-
* @returns {Object} SVG Group of polylines and isolated points
|
|
1332
|
-
*/
|
|
1333
|
-
renderPolyline(points) {
|
|
1334
|
-
const { data, lineColor, lineLength, lineStrokeWidth } = this.props;
|
|
1335
|
-
const linePoints = (0, lodash_exports.isFinite)(lineLength) && lineLength > 0 ? lineLength : points.length;
|
|
1336
|
-
const { lines, isolatedPoints } = this.getSegmentSets(
|
|
1337
|
-
data.slice(-linePoints),
|
|
1338
|
-
points.slice(-linePoints)
|
|
1339
|
-
);
|
|
1339
|
+
};
|
|
1340
|
+
const renderPolyline = (points2) => {
|
|
1341
|
+
const linePoints = (0, lodash_exports.isFinite)(lineLength) && lineLength > 0 ? lineLength : points2.length;
|
|
1342
|
+
const { lines, isolatedPoints } = getSegmentSets(data.slice(-linePoints), points2.slice(-linePoints));
|
|
1340
1343
|
return /* @__PURE__ */ react_default.createElement("g", { "data-test": "sparkline" }, lines.map((lineData) => /* @__PURE__ */ react_default.createElement(
|
|
1341
1344
|
"polyline",
|
|
1342
1345
|
{
|
|
@@ -1351,10 +1354,18 @@ var _SparkLine = class _SparkLine extends react_exports.Component {
|
|
|
1351
1354
|
},
|
|
1352
1355
|
points: lineData.join(" ")
|
|
1353
1356
|
}
|
|
1354
|
-
)),
|
|
1355
|
-
}
|
|
1356
|
-
getInteractionState
|
|
1357
|
-
|
|
1357
|
+
)), renderIsolatedPoints(isolatedPoints));
|
|
1358
|
+
};
|
|
1359
|
+
const getInteractionState = ({
|
|
1360
|
+
interactionData,
|
|
1361
|
+
points: interactionPoints,
|
|
1362
|
+
interactionShowTooltip,
|
|
1363
|
+
interactionActiveIndex,
|
|
1364
|
+
interactionHoveredIndex,
|
|
1365
|
+
interactionComponentIsFocused
|
|
1366
|
+
}) => {
|
|
1367
|
+
var _a2;
|
|
1368
|
+
if (!interactionShowTooltip) {
|
|
1358
1369
|
return {
|
|
1359
1370
|
currentPointX: null,
|
|
1360
1371
|
tooltipValue: null,
|
|
@@ -1362,200 +1373,94 @@ var _SparkLine = class _SparkLine extends react_exports.Component {
|
|
|
1362
1373
|
interactiveProps: {}
|
|
1363
1374
|
};
|
|
1364
1375
|
}
|
|
1365
|
-
const
|
|
1366
|
-
onKeyDown:
|
|
1367
|
-
onMouseOver:
|
|
1368
|
-
onMouseLeave:
|
|
1369
|
-
onFocus:
|
|
1370
|
-
onBlur:
|
|
1376
|
+
const interactiveProps2 = {
|
|
1377
|
+
onKeyDown: handleKeyDown,
|
|
1378
|
+
onMouseOver: handleMouseOver,
|
|
1379
|
+
onMouseLeave: handleMouseLeave,
|
|
1380
|
+
onFocus: handleFocus,
|
|
1381
|
+
onBlur: handleBlur
|
|
1371
1382
|
};
|
|
1372
|
-
const isHovered =
|
|
1373
|
-
const shouldDisplayInteractiveElements = (isHovered ||
|
|
1383
|
+
const isHovered = interactionHoveredIndex !== null;
|
|
1384
|
+
const shouldDisplayInteractiveElements = (isHovered || interactionComponentIsFocused) && interactionData.length > 0;
|
|
1374
1385
|
if (!shouldDisplayInteractiveElements) {
|
|
1375
1386
|
return {
|
|
1376
1387
|
currentPointX: null,
|
|
1377
1388
|
tooltipValue: null,
|
|
1378
1389
|
showCursorAndTooltip: false,
|
|
1379
|
-
interactiveProps
|
|
1390
|
+
interactiveProps: interactiveProps2
|
|
1380
1391
|
};
|
|
1381
1392
|
}
|
|
1382
|
-
const displayIndex = isHovered ?
|
|
1393
|
+
const displayIndex = isHovered ? interactionHoveredIndex : interactionActiveIndex;
|
|
1383
1394
|
const isValidIndex = displayIndex !== null && displayIndex >= 0;
|
|
1384
|
-
const withinBounds = isValidIndex && displayIndex <
|
|
1395
|
+
const withinBounds = isValidIndex && displayIndex < interactionData.length && displayIndex < interactionPoints.length;
|
|
1385
1396
|
if (!withinBounds) {
|
|
1386
1397
|
return {
|
|
1387
1398
|
currentPointX: null,
|
|
1388
1399
|
tooltipValue: null,
|
|
1389
1400
|
showCursorAndTooltip: false,
|
|
1390
|
-
interactiveProps
|
|
1401
|
+
interactiveProps: interactiveProps2
|
|
1391
1402
|
};
|
|
1392
1403
|
}
|
|
1393
|
-
const displayPointCoords =
|
|
1394
|
-
const
|
|
1395
|
-
const
|
|
1404
|
+
const displayPointCoords = interactionPoints[displayIndex];
|
|
1405
|
+
const currentPointX2 = (_a2 = displayPointCoords == null ? void 0 : displayPointCoords[0]) != null ? _a2 : null;
|
|
1406
|
+
const tooltipValue2 = interactionData[displayIndex];
|
|
1396
1407
|
return {
|
|
1397
|
-
currentPointX,
|
|
1398
|
-
tooltipValue,
|
|
1399
|
-
showCursorAndTooltip:
|
|
1400
|
-
interactiveProps
|
|
1408
|
+
currentPointX: currentPointX2,
|
|
1409
|
+
tooltipValue: tooltipValue2,
|
|
1410
|
+
showCursorAndTooltip: currentPointX2 !== null,
|
|
1411
|
+
interactiveProps: interactiveProps2
|
|
1401
1412
|
};
|
|
1413
|
+
};
|
|
1414
|
+
if (data.length === 0) {
|
|
1415
|
+
return null;
|
|
1402
1416
|
}
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1417
|
+
if (pointRefs.current.length !== data.length) {
|
|
1418
|
+
pointRefs.current.length = data.length;
|
|
1419
|
+
}
|
|
1420
|
+
const xMargin = endDotRadius + endDotStrokeWidth / 2;
|
|
1421
|
+
const yMargin = Math.max(lineStrokeWidth / 2, endDotRadius + endDotStrokeWidth / 2);
|
|
1422
|
+
const points = dataToPoints(xMargin, yMargin);
|
|
1423
|
+
const dotsToShow = Math.max(showEndDot && 1, (0, lodash_exports.isFinite)(endDotCount) && endDotCount > 0 && endDotCount);
|
|
1424
|
+
const { currentPointX, tooltipValue, showCursorAndTooltip, interactiveProps } = getInteractionState({
|
|
1425
|
+
interactionData: data,
|
|
1426
|
+
points,
|
|
1427
|
+
interactionShowTooltip: showTooltip,
|
|
1428
|
+
interactionActiveIndex: activeIndex,
|
|
1429
|
+
interactionHoveredIndex: hoveredIndex,
|
|
1430
|
+
interactionComponentIsFocused: componentIsFocused
|
|
1431
|
+
});
|
|
1432
|
+
const ariaLabel = title || (0, i18n_exports._)("Source count over time sparkline trend");
|
|
1433
|
+
return /* @__PURE__ */ react_default.createElement(
|
|
1434
|
+
"div",
|
|
1435
|
+
__spreadValues(__spreadValues({
|
|
1436
|
+
"data-test": "line",
|
|
1437
|
+
"data-test-type": isArea ? "area" : "line",
|
|
1438
|
+
ref: (el) => {
|
|
1439
|
+
containerRef.current = el;
|
|
1440
|
+
if (typeof elementRef === "function") {
|
|
1441
|
+
elementRef(el);
|
|
1442
|
+
} else if (elementRef && typeof elementRef === "object") {
|
|
1443
|
+
elementRef.current = el;
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
}, interactiveProps), (0, lodash_exports.omit)(restProps, PROP_KEYS)),
|
|
1447
|
+
/* @__PURE__ */ react_default.createElement(StyledSvg, { height, width, "aria-labelledby": titleId, "data-test": "sparkline-svg" }, /* @__PURE__ */ react_default.createElement("title", { id: titleId, "data-test": "sparkline-title" }, ariaLabel), /* @__PURE__ */ react_default.createElement("g", null, showTooltip ? renderCursor(currentPointX, showCursorAndTooltip) : null, renderPolyline(points), renderArea(points), dotsToShow ? renderEndDots(points, dotsToShow, xMargin) : null, renderRect(points, xMargin), showTooltip ? renderTooltip(tooltipValue, showCursorAndTooltip) : null))
|
|
1448
|
+
);
|
|
1449
|
+
};
|
|
1450
|
+
var SparkLine = (_a) => {
|
|
1451
|
+
var _b = _a, { data = [] } = _b, props = __objRest(_b, ["data"]);
|
|
1452
|
+
if (true) {
|
|
1453
|
+
if (!Array.isArray(data)) {
|
|
1454
|
+
console.error("Data provided to SparkLine must be an array.");
|
|
1420
1455
|
return null;
|
|
1421
1456
|
}
|
|
1422
|
-
if (
|
|
1423
|
-
|
|
1457
|
+
if (!data.every((value) => value === null || (0, lodash_exports.isFinite)(value))) {
|
|
1458
|
+
console.error("Data provided to SparkLine must contain finite numbers or null.");
|
|
1459
|
+
return null;
|
|
1424
1460
|
}
|
|
1425
|
-
const xMargin = endDotRadius + endDotStrokeWidth / 2;
|
|
1426
|
-
const yMargin = Math.max(lineStrokeWidth / 2, endDotRadius + endDotStrokeWidth / 2);
|
|
1427
|
-
const points = this.dataToPoints(xMargin, yMargin);
|
|
1428
|
-
const dotsToShow = Math.max(showEndDot && 1, (0, lodash_exports.isFinite)(endDotCount) && endDotCount > 0 && endDotCount);
|
|
1429
|
-
const { currentPointX, tooltipValue, showCursorAndTooltip, interactiveProps } = this.getInteractionState({
|
|
1430
|
-
data,
|
|
1431
|
-
points,
|
|
1432
|
-
showTooltip,
|
|
1433
|
-
activeIndex,
|
|
1434
|
-
hoveredIndex,
|
|
1435
|
-
componentIsFocused
|
|
1436
|
-
});
|
|
1437
|
-
const ariaLabel = title || (0, i18n_exports._)("Source count over time sparkline trend");
|
|
1438
|
-
return /* @__PURE__ */ react_default.createElement(
|
|
1439
|
-
"div",
|
|
1440
|
-
__spreadValues(__spreadValues({
|
|
1441
|
-
"data-test": "line",
|
|
1442
|
-
"data-test-type": isArea ? "area" : "line",
|
|
1443
|
-
ref: (el) => {
|
|
1444
|
-
this.containerRef.current = el;
|
|
1445
|
-
if (typeof elementRef === "function") {
|
|
1446
|
-
elementRef(el);
|
|
1447
|
-
} else if (elementRef && typeof elementRef === "object") {
|
|
1448
|
-
elementRef.current = el;
|
|
1449
|
-
}
|
|
1450
|
-
}
|
|
1451
|
-
}, interactiveProps), (0, lodash_exports.omit)(this.props, (0, lodash_exports.keys)(_SparkLine.propTypes))),
|
|
1452
|
-
/* @__PURE__ */ react_default.createElement(
|
|
1453
|
-
StyledSvg,
|
|
1454
|
-
{
|
|
1455
|
-
height,
|
|
1456
|
-
width,
|
|
1457
|
-
"aria-labelledby": this.titleId,
|
|
1458
|
-
"data-test": "sparkline-svg"
|
|
1459
|
-
},
|
|
1460
|
-
/* @__PURE__ */ react_default.createElement("title", { id: this.titleId, "data-test": "sparkline-title" }, ariaLabel),
|
|
1461
|
-
/* @__PURE__ */ react_default.createElement("g", null, showTooltip ? this.renderCursor(currentPointX, showCursorAndTooltip) : null, this.renderPolyline(points), this.renderArea(points), dotsToShow ? this.renderEndDots(points, dotsToShow, xMargin) : null, this.renderRect(points, xMargin), showTooltip ? this.renderTooltip(tooltipValue, showCursorAndTooltip) : null)
|
|
1462
|
-
)
|
|
1463
|
-
);
|
|
1464
1461
|
}
|
|
1462
|
+
return /* @__PURE__ */ react_default.createElement(SparkLineInner, __spreadValues({ data }, props));
|
|
1465
1463
|
};
|
|
1466
|
-
__publicField(_SparkLine, "propTypes", {
|
|
1467
|
-
/**
|
|
1468
|
-
* If true, data can contain `null` as a value and is treated as `0`. If false, this throws error when data contains `null`.
|
|
1469
|
-
*/
|
|
1470
|
-
acceptNull: prop_types_default.bool,
|
|
1471
|
-
/** Array of numbers. These data numbers are converted to points and show on sparkline. */
|
|
1472
|
-
data: (props) => {
|
|
1473
|
-
if (!(0, lodash_exports.isArray)(props.data)) {
|
|
1474
|
-
return new Error("Data provided to Sparkline must be an array.");
|
|
1475
|
-
}
|
|
1476
|
-
if (props.acceptNull && !props.data.every((value) => (0, lodash_exports.isNull)(value) || (0, lodash_exports.isFinite)(value))) {
|
|
1477
|
-
return new Error("Data provided to Sparkline must be finite numbers or null.");
|
|
1478
|
-
}
|
|
1479
|
-
if (!props.acceptNull && !props.data.every((value) => (0, lodash_exports.isFinite)(value))) {
|
|
1480
|
-
return new Error("Data provided to Sparkline must be finite numbers.");
|
|
1481
|
-
}
|
|
1482
|
-
return null;
|
|
1483
|
-
},
|
|
1484
|
-
/** A React ref which is set to the DOM element when the component mounts and `null` when it unmounts. */
|
|
1485
|
-
elementRef: prop_types_default.oneOfType([prop_types_default.func, prop_types_default.object]),
|
|
1486
|
-
/** Sets the number of end dots to display. When showEndDot is set to `true`, endDotCount is at least 1. If set to a positive value, this overrides showEndDot. */
|
|
1487
|
-
endDotCount: prop_types_default.number,
|
|
1488
|
-
/** Fills color to the end dot. */
|
|
1489
|
-
endDotFillColor: prop_types_default.string,
|
|
1490
|
-
/**
|
|
1491
|
-
* Sets end dot radius. End dot radius must be less than or equal to the margin. By default, its value equals the margin.
|
|
1492
|
-
*/
|
|
1493
|
-
endDotRadius: prop_types_default.number,
|
|
1494
|
-
/** Sets end dot circle stroke color. */
|
|
1495
|
-
endDotStroke: prop_types_default.string,
|
|
1496
|
-
/** Sets end dot circle stroke width in pixels. */
|
|
1497
|
-
endDotStrokeWidth: prop_types_default.number,
|
|
1498
|
-
/** Fills color to area. */
|
|
1499
|
-
fillColor: prop_types_default.string,
|
|
1500
|
-
/** Fills opacity to area. Value must be in 0 ~ 1. */
|
|
1501
|
-
fillOpacity: prop_types_default.string,
|
|
1502
|
-
/** Sets cursor stroke color. */
|
|
1503
|
-
cursorStroke: prop_types_default.string,
|
|
1504
|
-
/** Sets cursor stroke width in pixels. */
|
|
1505
|
-
cursorStrokeWidth: prop_types_default.number,
|
|
1506
|
-
/** Sets cursor line cap style. */
|
|
1507
|
-
cursorStrokeLinecap: prop_types_default.oneOf(["butt", "round", "square"]),
|
|
1508
|
-
/** Sets cursor dash array style. */
|
|
1509
|
-
cursorStrokeDasharray: prop_types_default.string,
|
|
1510
|
-
/**
|
|
1511
|
-
* Container height. If this value is specified, sparkline calculates the size using this height. If height isn't specified,
|
|
1512
|
-
* sparkline figures out the container height by itself.
|
|
1513
|
-
*/
|
|
1514
|
-
height: prop_types_default.number.isRequired,
|
|
1515
|
-
/** When set to `true`, sparkline shows as area. */
|
|
1516
|
-
isArea: prop_types_default.bool,
|
|
1517
|
-
/** The sparkline line color. */
|
|
1518
|
-
lineColor: prop_types_default.string,
|
|
1519
|
-
/** Allows user to draw only the last data points for the line. */
|
|
1520
|
-
lineLength: prop_types_default.number,
|
|
1521
|
-
/** The sparkline line stroke width in pixels. */
|
|
1522
|
-
lineStrokeWidth: prop_types_default.number,
|
|
1523
|
-
/** Enable to show end dot. */
|
|
1524
|
-
showEndDot: prop_types_default.bool,
|
|
1525
|
-
/** Enable to show tooltip. */
|
|
1526
|
-
showTooltip: prop_types_default.bool,
|
|
1527
|
-
/** Sets the data value range and maximum value shown on sparkline. */
|
|
1528
|
-
yMax: prop_types_default.number,
|
|
1529
|
-
/** Sets the data value range and minimum value shown on sparkline. */
|
|
1530
|
-
yMin: prop_types_default.number,
|
|
1531
|
-
/**
|
|
1532
|
-
* The width of the container.
|
|
1533
|
-
*/
|
|
1534
|
-
width: prop_types_default.number.isRequired,
|
|
1535
|
-
/** Sets the a11y title text on sparkline. */
|
|
1536
|
-
title: prop_types_default.string
|
|
1537
|
-
});
|
|
1538
|
-
__publicField(_SparkLine, "defaultProps", {
|
|
1539
|
-
acceptNull: false,
|
|
1540
|
-
data: [],
|
|
1541
|
-
showTooltip: true,
|
|
1542
|
-
endDotCount: 0,
|
|
1543
|
-
showEndDot: false,
|
|
1544
|
-
endDotRadius: 0,
|
|
1545
|
-
endDotFillColor: "white",
|
|
1546
|
-
endDotStroke: "black",
|
|
1547
|
-
endDotStrokeWidth: 0,
|
|
1548
|
-
fillColor: "#65a637",
|
|
1549
|
-
fillOpacity: ".1",
|
|
1550
|
-
cursorStroke: "#5184AF",
|
|
1551
|
-
cursorStrokeWidth: 3,
|
|
1552
|
-
cursorStrokeLinecap: "square",
|
|
1553
|
-
cursorStrokeDasharray: "1, 5",
|
|
1554
|
-
isArea: false,
|
|
1555
|
-
lineColor: "#65a637",
|
|
1556
|
-
lineStrokeWidth: 1
|
|
1557
|
-
});
|
|
1558
|
-
var SparkLine = _SparkLine;
|
|
1559
1464
|
var SparkLine_default = SparkLine;
|
|
1560
1465
|
|
|
1561
1466
|
// src/SingleValue/PureSingleValue/SingleValueSparkline.jsx
|
|
@@ -1679,7 +1584,7 @@ var getAvailableContentHeight = ({
|
|
|
1679
1584
|
}
|
|
1680
1585
|
return majorTextFontSize + CONTENT_SPARKLINE_SPACING + underLabelHeight;
|
|
1681
1586
|
};
|
|
1682
|
-
var isValidPosition = (sparklinePosition) => VALID_SPARKLINE_POSITIONS.
|
|
1587
|
+
var isValidPosition = (sparklinePosition) => VALID_SPARKLINE_POSITIONS.includes(sparklinePosition);
|
|
1683
1588
|
var parseSparklineValues = ({ sparklineValues }) => Array.isArray(sparklineValues) ? sparklineValues.map((v) => {
|
|
1684
1589
|
const numV = (0, numberUtils_exports.parseNumber)(v);
|
|
1685
1590
|
if (numV === 0) {
|
|
@@ -2008,15 +1913,13 @@ var SingleValue = (_a) => {
|
|
|
2008
1913
|
}
|
|
2009
1914
|
let { sparklineDisplay = "below", trendDisplay = "absolute", unit, underLabel } = props;
|
|
2010
1915
|
const parsedSparklineValues = parseSparklineValues({ sparklineValues });
|
|
1916
|
+
if (!isValidPosition(sparklineDisplay)) {
|
|
1917
|
+
sparklineDisplay = "below";
|
|
1918
|
+
}
|
|
2011
1919
|
let hasSparkline = shouldShowSparkline({
|
|
2012
|
-
showSparkline:
|
|
1920
|
+
showSparkline: sparklineDisplay !== "off",
|
|
2013
1921
|
sparklineValues: parsedSparklineValues
|
|
2014
1922
|
});
|
|
2015
|
-
if (hasSparkline) {
|
|
2016
|
-
if (!isValidPosition(sparklineDisplay)) {
|
|
2017
|
-
sparklineDisplay = "below";
|
|
2018
|
-
}
|
|
2019
|
-
}
|
|
2020
1923
|
const isSparklinePositionBelow = hasSparkline && sparklineDisplay === "below";
|
|
2021
1924
|
const contentWidth = getAvailableContentWidth({
|
|
2022
1925
|
hasSparkline,
|
|
@@ -2050,8 +1953,11 @@ var SingleValue = (_a) => {
|
|
|
2050
1953
|
});
|
|
2051
1954
|
if (!isEmpty_default(smallVizProps)) {
|
|
2052
1955
|
({ sparklineDisplay, trendDisplay, unit, underLabel } = smallVizProps);
|
|
1956
|
+
if (!isValidPosition(sparklineDisplay)) {
|
|
1957
|
+
sparklineDisplay = "below";
|
|
1958
|
+
}
|
|
2053
1959
|
hasSparkline = shouldShowSparkline({
|
|
2054
|
-
showSparkline:
|
|
1960
|
+
showSparkline: sparklineDisplay !== "off",
|
|
2055
1961
|
sparklineValues: parsedSparklineValues
|
|
2056
1962
|
});
|
|
2057
1963
|
}
|
|
@@ -2086,7 +1992,7 @@ var SingleValue = (_a) => {
|
|
|
2086
1992
|
majorValueTitle,
|
|
2087
1993
|
trendColor,
|
|
2088
1994
|
trendText,
|
|
2089
|
-
trendTextFontSize,
|
|
1995
|
+
trendTextFontSize: trendFontSize || Math.min(contentHeight, trendTextFontSize),
|
|
2090
1996
|
showTrendIndicator: shouldShowTrend(trendDisplay),
|
|
2091
1997
|
unit,
|
|
2092
1998
|
unitPosition,
|
|
@@ -2253,7 +2159,7 @@ var DefaultVizActionHandler = class {
|
|
|
2253
2159
|
var INITIAL_HEIGHT = 250;
|
|
2254
2160
|
var SplunkVisualization = class {
|
|
2255
2161
|
};
|
|
2256
|
-
SplunkVisualization
|
|
2162
|
+
__publicField(SplunkVisualization, "propTypes", {
|
|
2257
2163
|
/**
|
|
2258
2164
|
* display mode
|
|
2259
2165
|
*/
|
|
@@ -2329,11 +2235,11 @@ SplunkVisualization.propTypes = {
|
|
|
2329
2235
|
* A callback to request new data with updated request params
|
|
2330
2236
|
*/
|
|
2331
2237
|
onRequestParamsChange: prop_types_exports.func
|
|
2332
|
-
};
|
|
2238
|
+
});
|
|
2333
2239
|
/**
|
|
2334
2240
|
*
|
|
2335
2241
|
*/
|
|
2336
|
-
SplunkVisualization
|
|
2242
|
+
__publicField(SplunkVisualization, "defaults", {
|
|
2337
2243
|
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
2338
2244
|
width: "100%",
|
|
2339
2245
|
height: INITIAL_HEIGHT,
|
|
@@ -2348,7 +2254,7 @@ SplunkVisualization.defaults = {
|
|
|
2348
2254
|
onComputedProps: () => ({}),
|
|
2349
2255
|
loading: false,
|
|
2350
2256
|
onRequestParamsChange: lodash_exports.noop
|
|
2351
|
-
};
|
|
2257
|
+
});
|
|
2352
2258
|
var SplunkVisualization_default = SplunkVisualization;
|
|
2353
2259
|
|
|
2354
2260
|
// src/common/interfaces/DataSource.ts
|
|
@@ -2402,9 +2308,9 @@ var usePaginationParams = ({
|
|
|
2402
2308
|
meta,
|
|
2403
2309
|
onRequestParamsChange
|
|
2404
2310
|
}) => {
|
|
2405
|
-
const totalCount = meta
|
|
2406
|
-
const offset = requestParams
|
|
2407
|
-
const count = requestParams
|
|
2311
|
+
const totalCount = (meta == null ? void 0 : meta.totalCount) || 0;
|
|
2312
|
+
const offset = (requestParams == null ? void 0 : requestParams.offset) || 0;
|
|
2313
|
+
const count = requestParams == null ? void 0 : requestParams.count;
|
|
2408
2314
|
const totalPages = typeof count === "number" && count > 0 ? Math.ceil(totalCount / count) : 0;
|
|
2409
2315
|
const current = typeof count === "number" && count > 0 ? Math.floor(offset / count) + 1 : 0;
|
|
2410
2316
|
const isPaging = totalPages > 1 && typeof onRequestParamsChange === "function";
|
|
@@ -2454,7 +2360,7 @@ var Message_default = "default" in defaultImport29 ? defaultImport29.default : d
|
|
|
2454
2360
|
var isMissing = (v) => {
|
|
2455
2361
|
return v === null || v === void 0;
|
|
2456
2362
|
};
|
|
2457
|
-
var missingKeys = (
|
|
2363
|
+
var missingKeys = (keys, target) => keys.filter((k) => isMissing(target[k]));
|
|
2458
2364
|
var MissingPropsMessage = (props) => {
|
|
2459
2365
|
const {
|
|
2460
2366
|
width = SplunkVisualization_default.defaults.width,
|
|
@@ -2503,7 +2409,7 @@ var Cover = styled_components_default.div`
|
|
|
2503
2409
|
bottom: 0;
|
|
2504
2410
|
`;
|
|
2505
2411
|
var Blocker = styled_components_default.div.attrs({
|
|
2506
|
-
"data-splunk-visualization-version": "28.
|
|
2412
|
+
"data-splunk-visualization-version": "28.7.0 - d7b18cab6"
|
|
2507
2413
|
})`
|
|
2508
2414
|
position: relative;
|
|
2509
2415
|
width: 100%;
|
|
@@ -2593,7 +2499,7 @@ var withFixedSizeContainer = (Viz) => {
|
|
|
2593
2499
|
FixSizeItem,
|
|
2594
2500
|
{
|
|
2595
2501
|
"data-test": "fix-size-item",
|
|
2596
|
-
"data-splunk-visualization-version": "28.
|
|
2502
|
+
"data-splunk-visualization-version": "28.7.0 - d7b18cab6",
|
|
2597
2503
|
width,
|
|
2598
2504
|
height,
|
|
2599
2505
|
backgroundColor
|
|
@@ -3090,7 +2996,7 @@ var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
|
|
|
3090
2996
|
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
3091
2997
|
let splitDataSources = null;
|
|
3092
2998
|
let errorCode = null;
|
|
3093
|
-
if (fields
|
|
2999
|
+
if (fields == null ? void 0 : fields.length) {
|
|
3094
3000
|
splitDataSources = {};
|
|
3095
3001
|
for (let i = 0; i < fields.length; i += 1) {
|
|
3096
3002
|
const fieldName = fields[i].name;
|
|
@@ -3141,7 +3047,7 @@ var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
|
|
|
3141
3047
|
}
|
|
3142
3048
|
});
|
|
3143
3049
|
});
|
|
3144
|
-
} else if ((
|
|
3050
|
+
} else if (!(splitByFields == null ? void 0 : splitByFields.length) && fields.length > 1) {
|
|
3145
3051
|
splitDataSources = {};
|
|
3146
3052
|
for (let i = 1; i < fields.length; i += 1) {
|
|
3147
3053
|
const fieldName = fields[i].name;
|
|
@@ -3197,7 +3103,7 @@ var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
|
|
|
3197
3103
|
if (fields.length > 0) {
|
|
3198
3104
|
splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
|
|
3199
3105
|
}
|
|
3200
|
-
if (splitByFields
|
|
3106
|
+
if (splitByFields == null ? void 0 : splitByFields.includes(splitBy)) {
|
|
3201
3107
|
splitDataSources = {};
|
|
3202
3108
|
const dataSourceKeys = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
|
|
3203
3109
|
const valueKeys = [];
|
|
@@ -3228,6 +3134,68 @@ var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
|
|
|
3228
3134
|
}
|
|
3229
3135
|
return { splitDataSources, errorCode };
|
|
3230
3136
|
};
|
|
3137
|
+
var splitRowWise = (dataSource, columns, fields, otherSplitBy, dataSourceKeys, nonDataSourceAggregations) => {
|
|
3138
|
+
const splitDataSources = {};
|
|
3139
|
+
const valueKeys = (0, lodash_exports.cloneDeep)(columns[0]);
|
|
3140
|
+
valueKeys.forEach((val, idx) => {
|
|
3141
|
+
splitDataSources[val] = (0, lodash_exports.cloneDeep)((0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"]));
|
|
3142
|
+
splitDataSources[val].primary.data.fields = [];
|
|
3143
|
+
if (otherSplitBy.length) {
|
|
3144
|
+
splitDataSources[val].primary.data.fields = [{ name: otherSplitBy[0] }];
|
|
3145
|
+
}
|
|
3146
|
+
if (dataSourceKeys.length) {
|
|
3147
|
+
const columnValues = [[]];
|
|
3148
|
+
splitDataSources[val].primary.data.fields = [
|
|
3149
|
+
...splitDataSources[val].primary.data.fields,
|
|
3150
|
+
...dataSourceKeys.map((k) => ({ name: k }))
|
|
3151
|
+
];
|
|
3152
|
+
dataSourceKeys.forEach(() => {
|
|
3153
|
+
columnValues.push([]);
|
|
3154
|
+
});
|
|
3155
|
+
for (let i = 1; i <= Math.ceil((fields.length - 1) / dataSourceKeys.length); i += 1) {
|
|
3156
|
+
columnValues[0].push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
|
|
3157
|
+
dataSourceKeys.forEach((dskey, dsIndx) => {
|
|
3158
|
+
const mul = (fields.length - 1) / dataSourceKeys.length;
|
|
3159
|
+
columnValues[dsIndx + 1].push(columns[i + dsIndx * mul][idx]);
|
|
3160
|
+
});
|
|
3161
|
+
}
|
|
3162
|
+
splitDataSources[val].primary.data.columns = columnValues;
|
|
3163
|
+
} else if (nonDataSourceAggregations.length) {
|
|
3164
|
+
const columnValues = [];
|
|
3165
|
+
fields.forEach((aggregationField, fieldIdx) => {
|
|
3166
|
+
if (fieldIdx > 0) {
|
|
3167
|
+
splitDataSources[val].primary.data.fields.push(aggregationField);
|
|
3168
|
+
columnValues.push([columns[fieldIdx][idx]]);
|
|
3169
|
+
}
|
|
3170
|
+
});
|
|
3171
|
+
splitDataSources[val].primary.data.columns = columnValues;
|
|
3172
|
+
}
|
|
3173
|
+
});
|
|
3174
|
+
return splitDataSources;
|
|
3175
|
+
};
|
|
3176
|
+
var splitColumnWise = (dataSource, columns, fields, otherSplitBy, dataSourceKeys) => {
|
|
3177
|
+
const splitDataSources = {};
|
|
3178
|
+
const valueKeys = [];
|
|
3179
|
+
for (let i = 1; i < fields.length; i += 1) {
|
|
3180
|
+
valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
|
|
3181
|
+
}
|
|
3182
|
+
valueKeys.forEach((val) => {
|
|
3183
|
+
splitDataSources[val] = (0, lodash_exports.cloneDeep)((0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"]));
|
|
3184
|
+
splitDataSources[val].primary.data.fields = [
|
|
3185
|
+
{ name: otherSplitBy[0] },
|
|
3186
|
+
...dataSourceKeys.map((k) => ({ name: k }))
|
|
3187
|
+
];
|
|
3188
|
+
splitDataSources[val].primary.data.columns = [[...columns[0]]];
|
|
3189
|
+
dataSourceKeys.forEach((dsKey) => {
|
|
3190
|
+
fields.forEach((field, idx) => {
|
|
3191
|
+
if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
|
|
3192
|
+
splitDataSources[val].primary.data.columns.push([...columns[idx]]);
|
|
3193
|
+
}
|
|
3194
|
+
});
|
|
3195
|
+
});
|
|
3196
|
+
});
|
|
3197
|
+
return splitDataSources;
|
|
3198
|
+
};
|
|
3231
3199
|
var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
|
|
3232
3200
|
var _a, _b, _c, _d;
|
|
3233
3201
|
const fields = toFieldEntries((_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields);
|
|
@@ -3238,8 +3206,7 @@ var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
|
|
|
3238
3206
|
if (fields.length > 0) {
|
|
3239
3207
|
splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
|
|
3240
3208
|
}
|
|
3241
|
-
if (splitByFields
|
|
3242
|
-
splitDataSources = {};
|
|
3209
|
+
if (splitByFields == null ? void 0 : splitByFields.includes(splitBy)) {
|
|
3243
3210
|
const splitByFieldIdx = splitByFields.findIndex((f) => f === splitBy);
|
|
3244
3211
|
const otherSplitBy = splitByFields.filter((f) => f !== splitBy);
|
|
3245
3212
|
const dataSourceKeys = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
|
|
@@ -3250,71 +3217,16 @@ var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
|
|
|
3250
3217
|
}
|
|
3251
3218
|
}
|
|
3252
3219
|
if (splitByFieldIdx === 0) {
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
}
|
|
3262
|
-
if (dataSourceKeys.length) {
|
|
3263
|
-
const columnValues = [[]];
|
|
3264
|
-
splitDataSources[val].primary.data.fields = [
|
|
3265
|
-
...splitDataSources[val].primary.data.fields,
|
|
3266
|
-
...dataSourceKeys.map((k) => ({
|
|
3267
|
-
name: k
|
|
3268
|
-
}))
|
|
3269
|
-
];
|
|
3270
|
-
dataSourceKeys.forEach(() => {
|
|
3271
|
-
columnValues.push([]);
|
|
3272
|
-
});
|
|
3273
|
-
for (let i = 1; i <= Math.ceil((fields.length - 1) / dataSourceKeys.length); i += 1) {
|
|
3274
|
-
columnValues[0].push(
|
|
3275
|
-
fields[i].splitby_value ? fields[i].splitby_value : fields[i].name
|
|
3276
|
-
);
|
|
3277
|
-
dataSourceKeys.forEach((dskey, dsIndx) => {
|
|
3278
|
-
const mul = (fields.length - 1) / dataSourceKeys.length;
|
|
3279
|
-
columnValues[dsIndx + 1].push(columns[i + dsIndx * mul][idx]);
|
|
3280
|
-
});
|
|
3281
|
-
}
|
|
3282
|
-
splitDataSources[val].primary.data.columns = columnValues;
|
|
3283
|
-
} else if (nonDataSourceAggregations.length) {
|
|
3284
|
-
const columnValues = [];
|
|
3285
|
-
fields.forEach((aggregationField, fieldIdx) => {
|
|
3286
|
-
if (fieldIdx > 0) {
|
|
3287
|
-
splitDataSources[val].primary.data.fields.push(aggregationField);
|
|
3288
|
-
columnValues.push([columns[fieldIdx][idx]]);
|
|
3289
|
-
}
|
|
3290
|
-
});
|
|
3291
|
-
splitDataSources[val].primary.data.columns = columnValues;
|
|
3292
|
-
}
|
|
3293
|
-
});
|
|
3220
|
+
splitDataSources = splitRowWise(
|
|
3221
|
+
dataSource,
|
|
3222
|
+
columns,
|
|
3223
|
+
fields,
|
|
3224
|
+
otherSplitBy,
|
|
3225
|
+
dataSourceKeys,
|
|
3226
|
+
nonDataSourceAggregations
|
|
3227
|
+
);
|
|
3294
3228
|
} else {
|
|
3295
|
-
|
|
3296
|
-
for (let i = 1; i < fields.length; i += 1) {
|
|
3297
|
-
valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
|
|
3298
|
-
}
|
|
3299
|
-
valueKeys.forEach((val) => {
|
|
3300
|
-
splitDataSources[val] = (0, lodash_exports.cloneDeep)(
|
|
3301
|
-
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
3302
|
-
);
|
|
3303
|
-
splitDataSources[val].primary.data.fields = [
|
|
3304
|
-
{ name: otherSplitBy[0] },
|
|
3305
|
-
...dataSourceKeys.map((k) => ({
|
|
3306
|
-
name: k
|
|
3307
|
-
}))
|
|
3308
|
-
];
|
|
3309
|
-
splitDataSources[val].primary.data.columns = [[...columns[0]]];
|
|
3310
|
-
dataSourceKeys.forEach((dsKey) => {
|
|
3311
|
-
fields.forEach((field, idx) => {
|
|
3312
|
-
if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
|
|
3313
|
-
splitDataSources[val].primary.data.columns.push([...columns[idx]]);
|
|
3314
|
-
}
|
|
3315
|
-
});
|
|
3316
|
-
});
|
|
3317
|
-
});
|
|
3229
|
+
splitDataSources = splitColumnWise(dataSource, columns, fields, otherSplitBy, dataSourceKeys);
|
|
3318
3230
|
}
|
|
3319
3231
|
} else {
|
|
3320
3232
|
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
@@ -3332,7 +3244,7 @@ var dataSourcesSplitByModeStatsorUnknown = (dataSource, splitBy, splitMode) => {
|
|
|
3332
3244
|
splitByFields = splitMode !== trellisUtils_exports.UNKNOWN ? (0, trellisUtils_exports.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_exports.extractSplitByFieldsForUnknown)(fields);
|
|
3333
3245
|
}
|
|
3334
3246
|
const splitByIndex = fields.findIndex((field) => field.name === splitBy);
|
|
3335
|
-
if (splitByFields
|
|
3247
|
+
if (splitByFields == null ? void 0 : splitByFields.includes(splitBy)) {
|
|
3336
3248
|
const splitByColumn = (_f = (_e = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _e.data) == null ? void 0 : _f.columns[splitByIndex];
|
|
3337
3249
|
splitDataSources = {};
|
|
3338
3250
|
splitByColumn.forEach((val, idx) => {
|
|
@@ -3439,6 +3351,15 @@ var defaultImport35 = __toESM(require("@splunk/react-icons/Triangle"));
|
|
|
3439
3351
|
__reExport(Triangle_exports, require("@splunk/react-icons/Triangle"));
|
|
3440
3352
|
var Triangle_default = "default" in defaultImport35 ? defaultImport35.default : defaultImport35;
|
|
3441
3353
|
|
|
3354
|
+
// esm-externals:@splunk/visualizations-shared/simpleXMLOptions
|
|
3355
|
+
var simpleXMLOptions_exports = {};
|
|
3356
|
+
__export(simpleXMLOptions_exports, {
|
|
3357
|
+
default: () => simpleXMLOptions_default
|
|
3358
|
+
});
|
|
3359
|
+
var defaultImport36 = __toESM(require("@splunk/visualizations-shared/simpleXMLOptions"));
|
|
3360
|
+
__reExport(simpleXMLOptions_exports, require("@splunk/visualizations-shared/simpleXMLOptions"));
|
|
3361
|
+
var simpleXMLOptions_default = "default" in defaultImport36 ? defaultImport36.default : defaultImport36;
|
|
3362
|
+
|
|
3442
3363
|
// src/common/chartingUtils.ts
|
|
3443
3364
|
var DEFAULT_LINE_WIDTH = 2;
|
|
3444
3365
|
var getAnnotationsForCanvas = ({
|
|
@@ -3476,9 +3397,9 @@ var shouldEnableSearchZoom = (eventHandlers = [], xField = "") => {
|
|
|
3476
3397
|
const xAxisIsTime = xField === "_time";
|
|
3477
3398
|
return !!rangeSelectEventHandler && xAxisIsTime;
|
|
3478
3399
|
};
|
|
3479
|
-
var canvasSupportedTimeSeriesCharts = ["splunk.line"];
|
|
3400
|
+
var canvasSupportedTimeSeriesCharts = ["splunk.line", "splunk.area"];
|
|
3480
3401
|
var isTimeSeriesCanvasRenderSupported = (vizConfigKey) => {
|
|
3481
|
-
return canvasSupportedTimeSeriesCharts.
|
|
3402
|
+
return canvasSupportedTimeSeriesCharts.includes(vizConfigKey);
|
|
3482
3403
|
};
|
|
3483
3404
|
var filterChartDataFromInternalFields = (chartData) => {
|
|
3484
3405
|
const { fields, columns } = chartData;
|
|
@@ -3633,46 +3554,66 @@ var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInt
|
|
|
3633
3554
|
}
|
|
3634
3555
|
return y2Config;
|
|
3635
3556
|
};
|
|
3636
|
-
var
|
|
3557
|
+
var getSeriesType = (isOverlay, isAreaChart, isStacked) => {
|
|
3558
|
+
if (isOverlay) return "line";
|
|
3559
|
+
if (!isAreaChart) return void 0;
|
|
3560
|
+
return isStacked ? "stacked-area" : "area";
|
|
3561
|
+
};
|
|
3562
|
+
var getY2Scale = (field, y2fields, overlayFields) => {
|
|
3563
|
+
const assignToY2 = (y2fields == null ? void 0 : y2fields.length) > 0 && y2fields.includes(field) || !(y2fields == null ? void 0 : y2fields.length) && (overlayFields == null ? void 0 : overlayFields.includes(field));
|
|
3564
|
+
return assignToY2 ? "y2" : "y";
|
|
3565
|
+
};
|
|
3566
|
+
var getSeriesOverrides = (opts) => {
|
|
3567
|
+
var _a;
|
|
3568
|
+
const {
|
|
3569
|
+
yfields,
|
|
3570
|
+
y2fields,
|
|
3571
|
+
lineWidth,
|
|
3572
|
+
overlayFields,
|
|
3573
|
+
y2Enabled,
|
|
3574
|
+
nullValueMode,
|
|
3575
|
+
markerDisplay,
|
|
3576
|
+
lineDashStyle,
|
|
3577
|
+
lineDashStylesByField,
|
|
3578
|
+
stepPosition,
|
|
3579
|
+
stepPositionsByField,
|
|
3580
|
+
type,
|
|
3581
|
+
stackMode,
|
|
3582
|
+
showLines
|
|
3583
|
+
} = opts;
|
|
3637
3584
|
const seriesConfig = {};
|
|
3638
3585
|
let spanGaps;
|
|
3639
|
-
let replaceNullsWithZero;
|
|
3640
3586
|
if (nullValueMode === "gaps") {
|
|
3641
3587
|
spanGaps = false;
|
|
3642
|
-
} else if (nullValueMode
|
|
3588
|
+
} else if (nullValueMode != null) {
|
|
3643
3589
|
spanGaps = true;
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3590
|
+
} else {
|
|
3591
|
+
spanGaps = void 0;
|
|
3592
|
+
}
|
|
3593
|
+
const replaceNullsWithZero = nullValueMode === "zero" ? true : void 0;
|
|
3594
|
+
const isAreaChart = type === "area";
|
|
3595
|
+
const isStacked = isAreaChart && (stackMode === "stacked" || stackMode === "stacked100");
|
|
3596
|
+
const areaFields = isAreaChart ? yfields.filter((f) => !(overlayFields == null ? void 0 : overlayFields.includes(f))) : yfields;
|
|
3597
|
+
const overlayFieldsInOrder = (_a = overlayFields == null ? void 0 : overlayFields.filter((f) => yfields.includes(f))) != null ? _a : [];
|
|
3598
|
+
const orderedFields = isAreaChart ? [...areaFields, ...overlayFieldsInOrder] : yfields;
|
|
3599
|
+
orderedFields.forEach((field) => {
|
|
3600
|
+
var _a2;
|
|
3601
|
+
const isOverlay = (_a2 = overlayFields == null ? void 0 : overlayFields.includes(field)) != null ? _a2 : false;
|
|
3602
|
+
const isPercent = isAreaChart && stackMode === "stacked100" && !isOverlay;
|
|
3603
|
+
const shouldHideAreaOutline = isAreaChart && showLines === false && !isOverlay;
|
|
3649
3604
|
seriesConfig[field] = {
|
|
3650
|
-
overrides: {
|
|
3605
|
+
overrides: __spreadValues({
|
|
3606
|
+
width: shouldHideAreaOutline ? 0 : lineWidth != null ? lineWidth : DEFAULT_LINE_WIDTH
|
|
3607
|
+
}, isPercent ? { stacking: { mode: "percent", group: "A" } } : {})
|
|
3651
3608
|
};
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
if (y2Enabled)
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
);
|
|
3661
|
-
if (shouldAssignToY2) {
|
|
3662
|
-
seriesConfig[field].overrides.scale = "y2";
|
|
3663
|
-
} else {
|
|
3664
|
-
seriesConfig[field].overrides.scale = "y";
|
|
3665
|
-
}
|
|
3666
|
-
}
|
|
3667
|
-
if (overlayFields == null ? void 0 : overlayFields.includes(field)) {
|
|
3668
|
-
seriesConfig[field].type = "line";
|
|
3669
|
-
}
|
|
3670
|
-
if (markerDisplay !== void 0) {
|
|
3671
|
-
seriesConfig[field].markerDisplay = markerDisplay;
|
|
3672
|
-
}
|
|
3673
|
-
const fieldDashStyle = (lineDashStylesByField == null ? void 0 : lineDashStylesByField[field]) || lineDashStyle;
|
|
3674
|
-
if (fieldDashStyle) {
|
|
3675
|
-
seriesConfig[field].lineDashStyle = fieldDashStyle;
|
|
3609
|
+
const seriesType = getSeriesType(isOverlay, isAreaChart, isStacked);
|
|
3610
|
+
if (seriesType !== void 0) seriesConfig[field].type = seriesType;
|
|
3611
|
+
if (spanGaps !== void 0) seriesConfig[field].overrides.spanGaps = spanGaps;
|
|
3612
|
+
if (y2Enabled) seriesConfig[field].overrides.scale = getY2Scale(field, y2fields, overlayFields);
|
|
3613
|
+
if (markerDisplay !== void 0) seriesConfig[field].markerDisplay = markerDisplay;
|
|
3614
|
+
if (!isAreaChart || isOverlay) {
|
|
3615
|
+
const fieldDashStyle = (lineDashStylesByField == null ? void 0 : lineDashStylesByField[field]) || lineDashStyle;
|
|
3616
|
+
if (fieldDashStyle) seriesConfig[field].lineDashStyle = fieldDashStyle;
|
|
3676
3617
|
}
|
|
3677
3618
|
const hasFieldStepPosition = Object.hasOwn(stepPositionsByField || {}, field);
|
|
3678
3619
|
const fieldStepPosition = hasFieldStepPosition ? stepPositionsByField == null ? void 0 : stepPositionsByField[field] : stepPosition;
|
|
@@ -3838,6 +3779,38 @@ var parseArrayOption = (value) => {
|
|
|
3838
3779
|
}
|
|
3839
3780
|
return void 0;
|
|
3840
3781
|
};
|
|
3782
|
+
var getAreaOpacityForCanvas = (areaOpacity) => (
|
|
3783
|
+
// Preserve legacy visualizations behavior where area opacity is squared to match charting output.
|
|
3784
|
+
areaOpacity !== void 0 && areaOpacity !== null ? __pow(areaOpacity, 2) : areaOpacity
|
|
3785
|
+
);
|
|
3786
|
+
var parseTickIntervalOption = (simpleXMLValue, canvasValue) => {
|
|
3787
|
+
if (simpleXMLValue) return Number(simpleXMLValue);
|
|
3788
|
+
if (canvasValue) return Number(canvasValue);
|
|
3789
|
+
return void 0;
|
|
3790
|
+
};
|
|
3791
|
+
var getYAxisTitles = ({
|
|
3792
|
+
y2Enabled,
|
|
3793
|
+
yFields,
|
|
3794
|
+
y2Fields,
|
|
3795
|
+
overlayFields,
|
|
3796
|
+
yAxisTitleText,
|
|
3797
|
+
yAxisTitleVisibility,
|
|
3798
|
+
y2AxisTitleText,
|
|
3799
|
+
y2AxisTitleVisibility,
|
|
3800
|
+
containerHeight
|
|
3801
|
+
}) => {
|
|
3802
|
+
const yFieldsForTitle = y2Enabled ? yFields.filter((field) => !y2Fields.includes(field)) : yFields;
|
|
3803
|
+
const fieldsForY2Axis = y2Fields.length > 0 ? y2Fields : overlayFields;
|
|
3804
|
+
const yAxisTitle = ellipsisAxisTitle(
|
|
3805
|
+
getComputedAxisTitles(yAxisTitleText, yFieldsForTitle, yAxisTitleVisibility),
|
|
3806
|
+
containerHeight
|
|
3807
|
+
);
|
|
3808
|
+
const y2AxisTitle = ellipsisAxisTitle(
|
|
3809
|
+
getComputedAxisTitles(y2AxisTitleText, fieldsForY2Axis, y2AxisTitleVisibility),
|
|
3810
|
+
containerHeight
|
|
3811
|
+
);
|
|
3812
|
+
return { yAxisTitle, y2AxisTitle };
|
|
3813
|
+
};
|
|
3841
3814
|
var TimeSeriesChartWrapper = (props) => {
|
|
3842
3815
|
var _b, _c, _d;
|
|
3843
3816
|
const _a = props, {
|
|
@@ -3927,6 +3900,8 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
3927
3900
|
"chart.overlayFields": overlayFieldsStr,
|
|
3928
3901
|
"chart.nullValueMode": nullValueMode,
|
|
3929
3902
|
"chart.showDataLabels": showDataLabels,
|
|
3903
|
+
"chart.showLines": showLines,
|
|
3904
|
+
"chart.stackMode": stackMode,
|
|
3930
3905
|
lineWidth,
|
|
3931
3906
|
lineDashStyle,
|
|
3932
3907
|
fieldDashStyles: lineDashStylesByFieldStr,
|
|
@@ -3955,7 +3930,10 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
3955
3930
|
yAxisMinorTickSize,
|
|
3956
3931
|
y2AxisMinorTickSize,
|
|
3957
3932
|
showYAxisWithZero: showYAxisWithZeroFromOptions,
|
|
3958
|
-
showY2AxisWithZero: showY2AxisWithZeroFromOptions
|
|
3933
|
+
showY2AxisWithZero: showY2AxisWithZeroFromOptions,
|
|
3934
|
+
// area only props
|
|
3935
|
+
areaFillOpacity: areaOpacity,
|
|
3936
|
+
chart: chartType
|
|
3959
3937
|
} = options;
|
|
3960
3938
|
const dataValuesDisplay = showDataLabels === "none" ? "off" : showDataLabels;
|
|
3961
3939
|
const showYAxisWithZero = showYAxisWithZeroFromProps != null ? showYAxisWithZeroFromProps : showYAxisWithZeroFromOptions;
|
|
@@ -3972,13 +3950,11 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
3972
3950
|
const yAxisMax = parseAxisValue(yAxisMaxRaw);
|
|
3973
3951
|
const y2AxisMin = parseAxisValue(y2AxisMinRaw);
|
|
3974
3952
|
const y2AxisMax = parseAxisValue(y2AxisMaxRaw);
|
|
3975
|
-
const
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
const yAxisMajorTickIntervalNum = parseTickInterval(yAxisMajorUnitFromSimpleXML, yAxisMajorTickInterval);
|
|
3981
|
-
const y2AxisMajorTickIntervalNum = parseTickInterval(
|
|
3953
|
+
const yAxisMajorTickIntervalNum = parseTickIntervalOption(
|
|
3954
|
+
yAxisMajorUnitFromSimpleXML,
|
|
3955
|
+
yAxisMajorTickInterval
|
|
3956
|
+
);
|
|
3957
|
+
const y2AxisMajorTickIntervalNum = parseTickIntervalOption(
|
|
3982
3958
|
y2AxisMajorUnitFromSimpleXML,
|
|
3983
3959
|
y2AxisMajorTickInterval
|
|
3984
3960
|
);
|
|
@@ -3987,6 +3963,7 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
3987
3963
|
const y2AxisMajorTickSizeNum = y2AxisMajorTickSize != null ? Number(y2AxisMajorTickSize) : void 0;
|
|
3988
3964
|
const yAxisMinorTickSizeNum = yAxisMinorTickSize != null ? Number(yAxisMinorTickSize) : void 0;
|
|
3989
3965
|
const y2AxisMinorTickSizeNum = y2AxisMinorTickSize != null ? Number(y2AxisMinorTickSize) : void 0;
|
|
3966
|
+
const areaOpacityForCanvas = getAreaOpacityForCanvas(areaOpacity);
|
|
3990
3967
|
const seriesColors = seriesColorsStr ? JSON.parse(seriesColorsStr) : void 0;
|
|
3991
3968
|
const seriesColorsByField = fieldColors ? JSON.parse(fieldColors) : void 0;
|
|
3992
3969
|
const lineDashStylesByField = lineDashStylesByFieldStr ? JSON.parse(lineDashStylesByFieldStr) : void 0;
|
|
@@ -4017,26 +3994,40 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
4017
3994
|
);
|
|
4018
3995
|
let xAxisTitle = getComputedAxisTitles(xAxisTitleText, [xField], xAxisTitleVisibility);
|
|
4019
3996
|
xAxisTitle = ellipsisAxisTitle(xAxisTitle, containerWidth);
|
|
4020
|
-
const
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
3997
|
+
const { yAxisTitle, y2AxisTitle } = getYAxisTitles({
|
|
3998
|
+
y2Enabled,
|
|
3999
|
+
yFields,
|
|
4000
|
+
y2Fields,
|
|
4001
|
+
overlayFields,
|
|
4002
|
+
yAxisTitleText,
|
|
4003
|
+
yAxisTitleVisibility,
|
|
4004
|
+
y2AxisTitleText,
|
|
4005
|
+
y2AxisTitleVisibility,
|
|
4006
|
+
containerHeight
|
|
4007
|
+
});
|
|
4026
4008
|
const xScaleConfig = (0, react_exports.useMemo)(
|
|
4027
4009
|
() => getXScaleConfig(xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation),
|
|
4028
4010
|
[xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation]
|
|
4029
4011
|
);
|
|
4012
|
+
const isStacked100 = stackMode === "stacked100";
|
|
4030
4013
|
const yScaleConfig = (0, react_exports.useMemo)(
|
|
4031
|
-
() =>
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4014
|
+
() => {
|
|
4015
|
+
const config3 = getYScaleConfig(
|
|
4016
|
+
yAxisTitle,
|
|
4017
|
+
yAxisAbbreviation,
|
|
4018
|
+
yAxisScale,
|
|
4019
|
+
yAxisLabelVisibility,
|
|
4020
|
+
yAxisMin,
|
|
4021
|
+
yAxisMax
|
|
4022
|
+
);
|
|
4023
|
+
if (isStacked100) {
|
|
4024
|
+
config3.y.tickFmt = (v) => `${Math.round(v * 100)}%`;
|
|
4025
|
+
config3.y.range = () => [0, 1];
|
|
4026
|
+
}
|
|
4027
|
+
return config3;
|
|
4028
|
+
},
|
|
4029
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4030
|
+
[yAxisTitle, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax, isStacked100]
|
|
4040
4031
|
);
|
|
4041
4032
|
const y2ScaleConfig = (0, react_exports.useMemo)(() => {
|
|
4042
4033
|
if (y2Enabled) {
|
|
@@ -4068,10 +4059,11 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
4068
4059
|
];
|
|
4069
4060
|
chartData.fields = filteredChartData.fields;
|
|
4070
4061
|
chartData.columns = seriesDataFormatted;
|
|
4062
|
+
const normalizedStackMode = stackMode === "stacked" || stackMode === "stacked100" ? stackMode : "auto";
|
|
4071
4063
|
const seriesOverrides = (0, react_exports.useMemo)(
|
|
4072
|
-
() => getSeriesOverrides(
|
|
4073
|
-
yFields,
|
|
4074
|
-
y2Fields,
|
|
4064
|
+
() => getSeriesOverrides({
|
|
4065
|
+
yfields: yFields,
|
|
4066
|
+
y2fields: y2Fields,
|
|
4075
4067
|
lineWidth,
|
|
4076
4068
|
overlayFields,
|
|
4077
4069
|
y2Enabled,
|
|
@@ -4080,8 +4072,11 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
4080
4072
|
lineDashStyle,
|
|
4081
4073
|
lineDashStylesByField,
|
|
4082
4074
|
stepPosition,
|
|
4083
|
-
stepPositionsByField
|
|
4084
|
-
|
|
4075
|
+
stepPositionsByField,
|
|
4076
|
+
type: chartType,
|
|
4077
|
+
stackMode: normalizedStackMode,
|
|
4078
|
+
showLines
|
|
4079
|
+
}),
|
|
4085
4080
|
[
|
|
4086
4081
|
yFields,
|
|
4087
4082
|
y2Fields,
|
|
@@ -4093,7 +4088,10 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
4093
4088
|
lineDashStyle,
|
|
4094
4089
|
lineDashStylesByField,
|
|
4095
4090
|
stepPosition,
|
|
4096
|
-
stepPositionsByField
|
|
4091
|
+
stepPositionsByField,
|
|
4092
|
+
chartType,
|
|
4093
|
+
normalizedStackMode,
|
|
4094
|
+
showLines
|
|
4097
4095
|
]
|
|
4098
4096
|
);
|
|
4099
4097
|
const chartingEventAnnotations = (0, react_exports.useMemo)(
|
|
@@ -4161,50 +4159,54 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
4161
4159
|
react_exports.useEffect(() => {
|
|
4162
4160
|
additionalTooltipValuesRef.current = additionalTooltipValues;
|
|
4163
4161
|
}, [additionalTooltipValues]);
|
|
4162
|
+
const handleCrosshairMouseout = react_exports.useCallback(() => {
|
|
4163
|
+
if (onPointMouseOut && lastPayloadRef.current) {
|
|
4164
|
+
onPointMouseOut({
|
|
4165
|
+
type: "point.mouseout",
|
|
4166
|
+
originalEvent: lastOriginalEventRef.current,
|
|
4167
|
+
payload: lastPayloadRef.current
|
|
4168
|
+
});
|
|
4169
|
+
}
|
|
4170
|
+
previousMouseoverPayloadRef.current = null;
|
|
4171
|
+
}, [onPointMouseOut]);
|
|
4164
4172
|
const handleChartCrosshairChange = react_exports.useCallback(
|
|
4165
4173
|
(event) => {
|
|
4166
|
-
if (onPointMouseOver
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4174
|
+
if (!onPointMouseOver && !onPointMouseOut) {
|
|
4175
|
+
return;
|
|
4176
|
+
}
|
|
4177
|
+
if (!event) {
|
|
4178
|
+
handleCrosshairMouseout();
|
|
4179
|
+
return;
|
|
4180
|
+
}
|
|
4181
|
+
const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(event, "value", "seriesKey", "time", "index", "seriesIndex")), {
|
|
4182
|
+
name: event.seriesKey
|
|
4183
|
+
});
|
|
4184
|
+
delete payload.seriesKey;
|
|
4185
|
+
if (event.rowContext) {
|
|
4186
|
+
Object.assign(
|
|
4187
|
+
payload,
|
|
4188
|
+
Object.keys(event.rowContext).reduce((acc, fieldName) => {
|
|
4189
|
+
acc[`row.${fieldName}.value`] = event.rowContext[fieldName];
|
|
4190
|
+
return acc;
|
|
4191
|
+
}, {})
|
|
4192
|
+
);
|
|
4193
|
+
}
|
|
4194
|
+
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
4195
|
+
if (!hasMouseoverPayloadChanged(updatedPayload, previousMouseoverPayloadRef.current)) {
|
|
4196
|
+
return;
|
|
4197
|
+
}
|
|
4198
|
+
lastPayloadRef.current = updatedPayload;
|
|
4199
|
+
lastOriginalEventRef.current = event;
|
|
4200
|
+
previousMouseoverPayloadRef.current = __spreadValues({}, updatedPayload);
|
|
4201
|
+
if (onPointMouseOver) {
|
|
4202
|
+
onPointMouseOver({
|
|
4203
|
+
type: "point.mouseover",
|
|
4204
|
+
originalEvent: event,
|
|
4205
|
+
payload: updatedPayload
|
|
4180
4206
|
});
|
|
4181
|
-
delete payload.seriesKey;
|
|
4182
|
-
if (event.rowContext) {
|
|
4183
|
-
Object.assign(
|
|
4184
|
-
payload,
|
|
4185
|
-
Object.keys(event.rowContext).reduce((acc, fieldName) => {
|
|
4186
|
-
acc[`row.${fieldName}.value`] = event.rowContext[fieldName];
|
|
4187
|
-
return acc;
|
|
4188
|
-
}, {})
|
|
4189
|
-
);
|
|
4190
|
-
}
|
|
4191
|
-
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
4192
|
-
if (!hasMouseoverPayloadChanged(updatedPayload, previousMouseoverPayloadRef.current)) {
|
|
4193
|
-
return;
|
|
4194
|
-
}
|
|
4195
|
-
lastPayloadRef.current = updatedPayload;
|
|
4196
|
-
lastOriginalEventRef.current = event;
|
|
4197
|
-
previousMouseoverPayloadRef.current = __spreadValues({}, updatedPayload);
|
|
4198
|
-
if (onPointMouseOver) {
|
|
4199
|
-
onPointMouseOver({
|
|
4200
|
-
type: "point.mouseover",
|
|
4201
|
-
originalEvent: event,
|
|
4202
|
-
payload: updatedPayload
|
|
4203
|
-
});
|
|
4204
|
-
}
|
|
4205
4207
|
}
|
|
4206
4208
|
},
|
|
4207
|
-
[onPointMouseOver, onPointMouseOut, trellisKey, trellisSplitBy]
|
|
4209
|
+
[onPointMouseOver, onPointMouseOut, trellisKey, trellisSplitBy, handleCrosshairMouseout]
|
|
4208
4210
|
);
|
|
4209
4211
|
const dataKey = `${(_b = chartData.columns[0]) == null ? void 0 : _b[0]}-${(_c = chartData.columns[0]) == null ? void 0 : _c[chartData.columns[0].length - 1]}-${(_d = chartData.columns[0]) == null ? void 0 : _d.length}`;
|
|
4210
4212
|
const memoizedChart = (0, react_exports.useMemo)(() => {
|
|
@@ -4259,7 +4261,8 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
4259
4261
|
showXAxisLine,
|
|
4260
4262
|
showYAxisLine,
|
|
4261
4263
|
showY2AxisLine,
|
|
4262
|
-
xAxisMaxLabelParts
|
|
4264
|
+
xAxisMaxLabelParts,
|
|
4265
|
+
areaOpacity: areaOpacityForCanvas
|
|
4263
4266
|
}
|
|
4264
4267
|
));
|
|
4265
4268
|
}, [
|
|
@@ -4311,7 +4314,8 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
4311
4314
|
showYAxisLine,
|
|
4312
4315
|
showY2AxisLine,
|
|
4313
4316
|
legendMode,
|
|
4314
|
-
xAxisMaxLabelParts
|
|
4317
|
+
xAxisMaxLabelParts,
|
|
4318
|
+
areaOpacityForCanvas
|
|
4315
4319
|
]);
|
|
4316
4320
|
const memoizedVisualization = (0, react_exports.useMemo)(() => {
|
|
4317
4321
|
return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor: bgColor }, memoizedChart);
|
|
@@ -4339,6 +4343,37 @@ var TimeSeriesChartWrapper_default = TimeSeriesChartWrapper;
|
|
|
4339
4343
|
|
|
4340
4344
|
// src/common/withDashboardViz.tsx
|
|
4341
4345
|
var SanitizedTimeSeriesChartWrapper = (0, SanitizeProps_exports.withSanitizedProps)(TimeSeriesChartWrapper_default);
|
|
4346
|
+
var buildEventCallbackProps = (supportedEvents, evaluatedOptionsToUse, onEventTrigger) => {
|
|
4347
|
+
const result = {};
|
|
4348
|
+
Object.keys(supportedEvents).forEach((eventName) => {
|
|
4349
|
+
const { parentKeys, payloadKeys } = supportedEvents[eventName];
|
|
4350
|
+
const eventCallbackPropName = (0, lodash_exports.camelCase)(`on.${eventName}`);
|
|
4351
|
+
let payload = {};
|
|
4352
|
+
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
4353
|
+
payloadKeys.forEach((p) => {
|
|
4354
|
+
payload[p] = evaluatedOptionsToUse[p];
|
|
4355
|
+
});
|
|
4356
|
+
}
|
|
4357
|
+
result[eventCallbackPropName] = (ev) => {
|
|
4358
|
+
if (ev == null ? void 0 : ev.payload) {
|
|
4359
|
+
payload = __spreadValues({}, ev.payload);
|
|
4360
|
+
}
|
|
4361
|
+
return onEventTrigger({
|
|
4362
|
+
originalEvent: ev,
|
|
4363
|
+
payload,
|
|
4364
|
+
type: eventName
|
|
4365
|
+
});
|
|
4366
|
+
};
|
|
4367
|
+
if (parentKeys) {
|
|
4368
|
+
for (let i = parentKeys.length - 1; i >= 0; i -= 1) {
|
|
4369
|
+
const newObject = {};
|
|
4370
|
+
newObject[parentKeys[i]] = result[eventCallbackPropName];
|
|
4371
|
+
result[eventCallbackPropName] = newObject;
|
|
4372
|
+
}
|
|
4373
|
+
}
|
|
4374
|
+
});
|
|
4375
|
+
return result;
|
|
4376
|
+
};
|
|
4342
4377
|
var withDashboardViz = (opts) => {
|
|
4343
4378
|
const {
|
|
4344
4379
|
ReactViz,
|
|
@@ -4396,9 +4431,7 @@ var withDashboardViz = (opts) => {
|
|
|
4396
4431
|
const isDownsamplingEnabledByFeatureFlag = Boolean(
|
|
4397
4432
|
featureFlagContext == null ? void 0 : featureFlagContext.visualizations_enableDownsampling
|
|
4398
4433
|
);
|
|
4399
|
-
const isTrellisFeatureFlagOn2 = Boolean(
|
|
4400
|
-
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
4401
|
-
);
|
|
4434
|
+
const isTrellisFeatureFlagOn2 = Boolean(featureFlagContext == null ? void 0 : featureFlagContext.visualizations_enableTrellis);
|
|
4402
4435
|
const isTrellisOn = isTrellisFeatureFlagOn2 && ((_a = vizConfig == null ? void 0 : vizConfig.supports) == null ? void 0 : _a.includes("trellis" /* TRELLIS */)) && (options == null ? void 0 : options.splitByLayout) === "trellis" /* TRELLIS */;
|
|
4403
4436
|
const isAcceleratedRenderFeatureFlagOn = Boolean(
|
|
4404
4437
|
featureFlagContext == null ? void 0 : featureFlagContext.visualizations_enableAcceleratedRender
|
|
@@ -4563,38 +4596,12 @@ var withDashboardViz = (opts) => {
|
|
|
4563
4596
|
}
|
|
4564
4597
|
);
|
|
4565
4598
|
}
|
|
4566
|
-
const eventCallbackProps = {};
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
let payload = {};
|
|
4573
|
-
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
4574
|
-
payloadKeys.forEach((p) => {
|
|
4575
|
-
payload[p] = evaluatedOptionsToUse[p];
|
|
4576
|
-
});
|
|
4577
|
-
}
|
|
4578
|
-
eventCallbackProps[eventCallbackPropName] = (ev) => {
|
|
4579
|
-
if (ev == null ? void 0 : ev.payload) {
|
|
4580
|
-
payload = __spreadValues({}, ev.payload);
|
|
4581
|
-
}
|
|
4582
|
-
return onEventTrigger({
|
|
4583
|
-
originalEvent: ev,
|
|
4584
|
-
payload,
|
|
4585
|
-
type: eventName
|
|
4586
|
-
});
|
|
4587
|
-
};
|
|
4588
|
-
if (parentKeys) {
|
|
4589
|
-
for (let i = parentKeys.length - 1; i >= 0; i -= 1) {
|
|
4590
|
-
const newObject = {};
|
|
4591
|
-
newObject[parentKeys[i]] = eventCallbackProps[eventCallbackPropName];
|
|
4592
|
-
eventCallbackProps[eventCallbackPropName] = newObject;
|
|
4593
|
-
}
|
|
4594
|
-
}
|
|
4595
|
-
});
|
|
4596
|
-
}
|
|
4597
|
-
const computedVizProps = computeVizProps2(__spreadProps(__spreadValues(__spreadValues(__spreadValues({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
4599
|
+
const eventCallbackProps = hasEventHandlers && mode === "view" && vizConfig.supports.includes("events" /* EVENTS */) ? buildEventCallbackProps(vizConfig.events, evaluatedOptionsToUse, onEventTrigger) : {};
|
|
4600
|
+
const computedVizProps = computeVizProps2(__spreadProps(__spreadValues(__spreadProps(__spreadValues(__spreadValues({}, props), evaluatedOptionsToUse), {
|
|
4601
|
+
// Align option transformation with the actual renderer selected below.
|
|
4602
|
+
// This prevents canvas-only option preservation from leaking into Highcharts mode.
|
|
4603
|
+
isAcceleratedRenderOn
|
|
4604
|
+
}), eventCallbackProps), {
|
|
4598
4605
|
themeFunc
|
|
4599
4606
|
}));
|
|
4600
4607
|
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
@@ -4628,45 +4635,45 @@ var PresetPalettes_exports = {};
|
|
|
4628
4635
|
__export(PresetPalettes_exports, {
|
|
4629
4636
|
default: () => PresetPalettes_default
|
|
4630
4637
|
});
|
|
4631
|
-
var
|
|
4638
|
+
var defaultImport37 = __toESM(require("@splunk/visualization-color-palettes/editors/PresetPalettes"));
|
|
4632
4639
|
__reExport(PresetPalettes_exports, require("@splunk/visualization-color-palettes/editors/PresetPalettes"));
|
|
4633
|
-
var PresetPalettes_default = "default" in
|
|
4640
|
+
var PresetPalettes_default = "default" in defaultImport37 ? defaultImport37.default : defaultImport37;
|
|
4634
4641
|
|
|
4635
4642
|
// esm-externals:@splunk/visualization-themes/variables
|
|
4636
4643
|
var variables_exports2 = {};
|
|
4637
4644
|
__export(variables_exports2, {
|
|
4638
4645
|
default: () => variables_default2
|
|
4639
4646
|
});
|
|
4640
|
-
var
|
|
4647
|
+
var defaultImport38 = __toESM(require("@splunk/visualization-themes/variables"));
|
|
4641
4648
|
__reExport(variables_exports2, require("@splunk/visualization-themes/variables"));
|
|
4642
|
-
var variables_default2 = "default" in
|
|
4649
|
+
var variables_default2 = "default" in defaultImport38 ? defaultImport38.default : defaultImport38;
|
|
4643
4650
|
|
|
4644
4651
|
// esm-externals:@splunk/themes/pick
|
|
4645
4652
|
var pick_exports2 = {};
|
|
4646
4653
|
__export(pick_exports2, {
|
|
4647
4654
|
default: () => pick_default2
|
|
4648
4655
|
});
|
|
4649
|
-
var
|
|
4656
|
+
var defaultImport39 = __toESM(require("@splunk/themes/pick"));
|
|
4650
4657
|
__reExport(pick_exports2, require("@splunk/themes/pick"));
|
|
4651
|
-
var pick_default2 = "default" in
|
|
4658
|
+
var pick_default2 = "default" in defaultImport39 ? defaultImport39.default : defaultImport39;
|
|
4652
4659
|
|
|
4653
4660
|
// esm-externals:@splunk/visualization-icons
|
|
4654
4661
|
var visualization_icons_exports = {};
|
|
4655
4662
|
__export(visualization_icons_exports, {
|
|
4656
4663
|
default: () => visualization_icons_default
|
|
4657
4664
|
});
|
|
4658
|
-
var
|
|
4665
|
+
var defaultImport40 = __toESM(require("@splunk/visualization-icons"));
|
|
4659
4666
|
__reExport(visualization_icons_exports, require("@splunk/visualization-icons"));
|
|
4660
|
-
var visualization_icons_default = "default" in
|
|
4667
|
+
var visualization_icons_default = "default" in defaultImport40 ? defaultImport40.default : defaultImport40;
|
|
4661
4668
|
|
|
4662
4669
|
// esm-externals:@splunk/visualization-icons/placeholders
|
|
4663
4670
|
var placeholders_exports = {};
|
|
4664
4671
|
__export(placeholders_exports, {
|
|
4665
4672
|
default: () => placeholders_default
|
|
4666
4673
|
});
|
|
4667
|
-
var
|
|
4674
|
+
var defaultImport41 = __toESM(require("@splunk/visualization-icons/placeholders"));
|
|
4668
4675
|
__reExport(placeholders_exports, require("@splunk/visualization-icons/placeholders"));
|
|
4669
|
-
var placeholders_default = "default" in
|
|
4676
|
+
var placeholders_default = "default" in defaultImport41 ? defaultImport41.default : defaultImport41;
|
|
4670
4677
|
|
|
4671
4678
|
// src/common/configContext/singleValueContext.ts
|
|
4672
4679
|
var defaultContext = {
|
|
@@ -4698,9 +4705,9 @@ var configUtils_exports = {};
|
|
|
4698
4705
|
__export(configUtils_exports, {
|
|
4699
4706
|
default: () => configUtils_default
|
|
4700
4707
|
});
|
|
4701
|
-
var
|
|
4708
|
+
var defaultImport42 = __toESM(require("@splunk/visualizations-shared/configUtils"));
|
|
4702
4709
|
__reExport(configUtils_exports, require("@splunk/visualizations-shared/configUtils"));
|
|
4703
|
-
var configUtils_default = "default" in
|
|
4710
|
+
var configUtils_default = "default" in defaultImport42 ? defaultImport42.default : defaultImport42;
|
|
4704
4711
|
|
|
4705
4712
|
// src/common/editorConfig/DynamicMajorColorEditor.js
|
|
4706
4713
|
var getDynamicMajorColorEditor = ({ defaultContext: defaultContext2, defaultPalettesConfig: defaultPalettesConfig2 }) => ({
|
|
@@ -4912,26 +4919,59 @@ var isTrellisEnabled = ({ options, featureFlags }) => {
|
|
|
4912
4919
|
const { splitByLayout = visualization_schemas_exports.LAYOUT_TYPE.Off } = options;
|
|
4913
4920
|
return isTrellisFeatureFlagOn({ featureFlags }) && splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
|
|
4914
4921
|
};
|
|
4915
|
-
var
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4922
|
+
var sortByValuesBase = [
|
|
4923
|
+
{ label: (0, i18n_exports._)("Result"), value: "result" },
|
|
4924
|
+
{ label: (0, i18n_exports._)("Name"), value: "name" }
|
|
4925
|
+
];
|
|
4926
|
+
var sortByValuesWithValue = [...sortByValuesBase, { label: (0, i18n_exports._)("Value"), value: "value" }];
|
|
4927
|
+
var sortByValuesWithValueAndTrend = [
|
|
4928
|
+
...sortByValuesBase,
|
|
4929
|
+
{ label: (0, i18n_exports._)("Value"), value: "value" },
|
|
4930
|
+
{ label: (0, i18n_exports._)("Trend"), value: "trend" }
|
|
4931
|
+
];
|
|
4932
|
+
var makeSortRow = (sortByValues) => [
|
|
4933
|
+
{
|
|
4934
|
+
label: (0, i18n_exports._)("Sort by"),
|
|
4935
|
+
option: "trellisSortBy",
|
|
4936
|
+
editor: "editor.select",
|
|
4937
|
+
editorProps: {
|
|
4938
|
+
values: sortByValues
|
|
4939
|
+
},
|
|
4940
|
+
showEditor: isTrellisEnabled
|
|
4941
|
+
},
|
|
4942
|
+
{
|
|
4943
|
+
label: (0, i18n_exports._)("Sort order"),
|
|
4944
|
+
option: "trellisSortOrder",
|
|
4945
|
+
editor: "editor.select",
|
|
4946
|
+
editorProps: {
|
|
4947
|
+
values: [
|
|
4948
|
+
{ label: (0, i18n_exports._)("Ascending"), value: "ascending" },
|
|
4949
|
+
{ label: (0, i18n_exports._)("Descending"), value: "descending" }
|
|
4950
|
+
]
|
|
4951
|
+
},
|
|
4952
|
+
showEditor: isTrellisEnabled
|
|
4953
|
+
}
|
|
4954
|
+
];
|
|
4955
|
+
var trellisLayoutRow = [
|
|
4956
|
+
{
|
|
4957
|
+
label: (0, i18n_exports._)("Trellis layout"),
|
|
4958
|
+
option: "splitByLayout",
|
|
4959
|
+
editor: "editor.toggle",
|
|
4960
|
+
showEditor: isTrellisFeatureFlagOn
|
|
4961
|
+
}
|
|
4962
|
+
];
|
|
4963
|
+
var trellisSplitByRow = [
|
|
4964
|
+
{
|
|
4965
|
+
label: (0, i18n_exports._)("Split by"),
|
|
4966
|
+
option: "trellisSplitBy",
|
|
4967
|
+
editor: "editor.trellisSplitBy",
|
|
4968
|
+
editorProps: {
|
|
4969
|
+
dataSourceKey: "primary"
|
|
4970
|
+
},
|
|
4971
|
+
showEditor: isTrellisEnabled
|
|
4972
|
+
}
|
|
4973
|
+
];
|
|
4974
|
+
var trellisLayoutRows = [
|
|
4935
4975
|
[
|
|
4936
4976
|
{
|
|
4937
4977
|
label: (0, i18n_exports._)("Number of columns"),
|
|
@@ -4975,6 +5015,24 @@ var TrellisEditorConfig = [
|
|
|
4975
5015
|
}
|
|
4976
5016
|
]
|
|
4977
5017
|
];
|
|
5018
|
+
var TrellisEditorConfig = [
|
|
5019
|
+
trellisLayoutRow,
|
|
5020
|
+
trellisSplitByRow,
|
|
5021
|
+
makeSortRow(sortByValuesBase),
|
|
5022
|
+
...trellisLayoutRows
|
|
5023
|
+
];
|
|
5024
|
+
var GaugeTrellisEditorConfig = [
|
|
5025
|
+
trellisLayoutRow,
|
|
5026
|
+
trellisSplitByRow,
|
|
5027
|
+
makeSortRow(sortByValuesWithValue),
|
|
5028
|
+
...trellisLayoutRows
|
|
5029
|
+
];
|
|
5030
|
+
var SingleValueTrellisEditorConfig = [
|
|
5031
|
+
trellisLayoutRow,
|
|
5032
|
+
trellisSplitByRow,
|
|
5033
|
+
makeSortRow(sortByValuesWithValueAndTrend),
|
|
5034
|
+
...trellisLayoutRows
|
|
5035
|
+
];
|
|
4978
5036
|
var TimechartTrellisEditorConfig = [
|
|
4979
5037
|
[
|
|
4980
5038
|
{
|
|
@@ -4982,7 +5040,6 @@ var TimechartTrellisEditorConfig = [
|
|
|
4982
5040
|
option: "splitByLayout",
|
|
4983
5041
|
editor: "editor.toggle",
|
|
4984
5042
|
showEditor: isTrellisFeatureFlagOn,
|
|
4985
|
-
// add help text for timecharts
|
|
4986
5043
|
editorProps: {
|
|
4987
5044
|
help: (0, i18n_exports._)(
|
|
4988
5045
|
"Y2-axis and overlay field configurations are not supported when trellis is enabled."
|
|
@@ -4991,7 +5048,9 @@ var TimechartTrellisEditorConfig = [
|
|
|
4991
5048
|
}
|
|
4992
5049
|
}
|
|
4993
5050
|
],
|
|
4994
|
-
|
|
5051
|
+
trellisSplitByRow,
|
|
5052
|
+
makeSortRow(sortByValuesBase),
|
|
5053
|
+
...trellisLayoutRows,
|
|
4995
5054
|
[
|
|
4996
5055
|
{
|
|
4997
5056
|
label: (0, i18n_exports._)("Shared y-axis scale"),
|
|
@@ -5284,7 +5343,7 @@ var editorConfig = [
|
|
|
5284
5343
|
showEditor: ({ options }) => options.sparklineDisplay !== "off"
|
|
5285
5344
|
}
|
|
5286
5345
|
],
|
|
5287
|
-
...
|
|
5346
|
+
...SingleValueTrellisEditorConfig
|
|
5288
5347
|
]
|
|
5289
5348
|
},
|
|
5290
5349
|
{
|
|
@@ -5299,7 +5358,7 @@ var editorConfig = [
|
|
|
5299
5358
|
presets,
|
|
5300
5359
|
value: ({ context, options }) => {
|
|
5301
5360
|
const initialPreset = getInitialPreset(context, options, presets);
|
|
5302
|
-
return initialPreset
|
|
5361
|
+
return (initialPreset == null ? void 0 : initialPreset.label) || null;
|
|
5303
5362
|
}
|
|
5304
5363
|
}
|
|
5305
5364
|
}
|
|
@@ -5440,29 +5499,76 @@ var Paginator_exports = {};
|
|
|
5440
5499
|
__export(Paginator_exports, {
|
|
5441
5500
|
default: () => Paginator_default
|
|
5442
5501
|
});
|
|
5443
|
-
var
|
|
5502
|
+
var defaultImport43 = __toESM(require("@splunk/react-ui/Paginator"));
|
|
5444
5503
|
__reExport(Paginator_exports, require("@splunk/react-ui/Paginator"));
|
|
5445
|
-
var Paginator_default = "default" in
|
|
5504
|
+
var Paginator_default = "default" in defaultImport43 ? defaultImport43.default : defaultImport43;
|
|
5446
5505
|
|
|
5447
5506
|
// esm-externals:@splunk/themes
|
|
5448
5507
|
var themes_exports = {};
|
|
5449
5508
|
__export(themes_exports, {
|
|
5450
5509
|
default: () => themes_default
|
|
5451
5510
|
});
|
|
5452
|
-
var
|
|
5511
|
+
var defaultImport44 = __toESM(require("@splunk/themes"));
|
|
5453
5512
|
__reExport(themes_exports, require("@splunk/themes"));
|
|
5454
|
-
var themes_default = "default" in
|
|
5513
|
+
var themes_default = "default" in defaultImport44 ? defaultImport44.default : defaultImport44;
|
|
5455
5514
|
|
|
5456
5515
|
// esm-externals:@splunk/themes/useSplunkTheme
|
|
5457
5516
|
var useSplunkTheme_exports = {};
|
|
5458
5517
|
__export(useSplunkTheme_exports, {
|
|
5459
5518
|
default: () => useSplunkTheme_default
|
|
5460
5519
|
});
|
|
5461
|
-
var
|
|
5520
|
+
var defaultImport45 = __toESM(require("@splunk/themes/useSplunkTheme"));
|
|
5462
5521
|
__reExport(useSplunkTheme_exports, require("@splunk/themes/useSplunkTheme"));
|
|
5463
|
-
var useSplunkTheme_default = "default" in
|
|
5522
|
+
var useSplunkTheme_default = "default" in defaultImport45 ? defaultImport45.default : defaultImport45;
|
|
5464
5523
|
|
|
5465
5524
|
// src/common/hocs/withTrellis.tsx
|
|
5525
|
+
var evaluatePanelOption = (panelDataSources, allOptions, optionKey, vizContext) => {
|
|
5526
|
+
try {
|
|
5527
|
+
const evaluated = Options_exports.Options.evaluate({ context: vizContext, options: allOptions }, panelDataSources);
|
|
5528
|
+
const num = Number(evaluated == null ? void 0 : evaluated[optionKey]);
|
|
5529
|
+
return Number.isNaN(num) ? Number.NaN : num;
|
|
5530
|
+
} catch (e) {
|
|
5531
|
+
return Number.NaN;
|
|
5532
|
+
}
|
|
5533
|
+
};
|
|
5534
|
+
var sortTrellisKeys = (keys, trellisSortBy, trellisSortOrder, modifiedDataSourceBySplitBy, mergedOptions, vizContext) => {
|
|
5535
|
+
if (trellisSortBy === "name") {
|
|
5536
|
+
keys.sort((a, b) => {
|
|
5537
|
+
const cmp = a.localeCompare(b, void 0, { numeric: true, sensitivity: "base" });
|
|
5538
|
+
return trellisSortOrder === "descending" ? -cmp : cmp;
|
|
5539
|
+
});
|
|
5540
|
+
} else if (trellisSortBy === "value" || trellisSortBy === "trend") {
|
|
5541
|
+
let optionKey;
|
|
5542
|
+
if (trellisSortBy === "trend") {
|
|
5543
|
+
optionKey = "trendValue";
|
|
5544
|
+
} else {
|
|
5545
|
+
optionKey = mergedOptions.value !== void 0 ? "value" : "majorValue";
|
|
5546
|
+
}
|
|
5547
|
+
keys.sort((a, b) => {
|
|
5548
|
+
const valA = evaluatePanelOption(
|
|
5549
|
+
modifiedDataSourceBySplitBy[a],
|
|
5550
|
+
mergedOptions,
|
|
5551
|
+
optionKey,
|
|
5552
|
+
vizContext
|
|
5553
|
+
);
|
|
5554
|
+
const valB = evaluatePanelOption(
|
|
5555
|
+
modifiedDataSourceBySplitBy[b],
|
|
5556
|
+
mergedOptions,
|
|
5557
|
+
optionKey,
|
|
5558
|
+
vizContext
|
|
5559
|
+
);
|
|
5560
|
+
const nanA = Number.isNaN(valA);
|
|
5561
|
+
const nanB = Number.isNaN(valB);
|
|
5562
|
+
if (nanA && nanB) return 0;
|
|
5563
|
+
if (nanA) return 1;
|
|
5564
|
+
if (nanB) return -1;
|
|
5565
|
+
const cmp = valA - valB;
|
|
5566
|
+
return trellisSortOrder === "descending" ? -cmp : cmp;
|
|
5567
|
+
});
|
|
5568
|
+
} else if (trellisSortOrder === "descending") {
|
|
5569
|
+
keys.reverse();
|
|
5570
|
+
}
|
|
5571
|
+
};
|
|
5466
5572
|
var TrellisContainer = styled_components_default.div`
|
|
5467
5573
|
overflow: hidden;
|
|
5468
5574
|
display: flex;
|
|
@@ -5507,6 +5613,14 @@ var showErrorMessage = (errorCode, width, height) => {
|
|
|
5507
5613
|
}
|
|
5508
5614
|
return /* @__PURE__ */ react_exports.createElement(Message_default, { width, height, message: (0, i18n_exports._)("Error render in trellis"), level: "info" });
|
|
5509
5615
|
};
|
|
5616
|
+
var resolveTrellisSplitBy = (trellisSplitBy, fields) => {
|
|
5617
|
+
var _a;
|
|
5618
|
+
if (trellisSplitBy && trellisSplitBy.length > 0) {
|
|
5619
|
+
return trellisSplitBy;
|
|
5620
|
+
}
|
|
5621
|
+
const splitByPossibleFields = (0, trellisUtils_exports.getAllPossibleSplitByFields)(fields);
|
|
5622
|
+
return ((_a = splitByPossibleFields.fields) == null ? void 0 : _a.length) ? splitByPossibleFields.fields[0] : AGGREGATIONS;
|
|
5623
|
+
};
|
|
5510
5624
|
var withTrellis = (Viz) => {
|
|
5511
5625
|
const VizWithTrellis = (opts) => {
|
|
5512
5626
|
const cachedHandleResize = react_exports.useCallback((w, h) => {
|
|
@@ -5515,7 +5629,7 @@ var withTrellis = (Viz) => {
|
|
|
5515
5629
|
}, []);
|
|
5516
5630
|
const [containerWidth, setContainerWidth] = react_exports.useState(Number(opts.width));
|
|
5517
5631
|
const [containerHeight, setContainerHeight] = react_exports.useState(Number(opts.height));
|
|
5518
|
-
const _a = opts, { options = {}, height, width } = _a, otherProps = __objRest(_a, ["options", "height", "width"]);
|
|
5632
|
+
const _a = opts, { options = {}, context = {}, height, width } = _a, otherProps = __objRest(_a, ["options", "context", "height", "width"]);
|
|
5519
5633
|
const defaultOptions = (0, JSONSchemaUtils_exports.pickFieldFromJSONSchema)(Viz.config.optionsSchema, "default");
|
|
5520
5634
|
const mergedOptions = (0, hocUtils_exports.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions);
|
|
5521
5635
|
const {
|
|
@@ -5525,6 +5639,8 @@ var withTrellis = (Viz) => {
|
|
|
5525
5639
|
trellisRowHeight,
|
|
5526
5640
|
splitByLayout,
|
|
5527
5641
|
trellisSplitBy,
|
|
5642
|
+
trellisSortBy,
|
|
5643
|
+
trellisSortOrder,
|
|
5528
5644
|
trellisSharedScale,
|
|
5529
5645
|
stackMode,
|
|
5530
5646
|
yAxisMin,
|
|
@@ -5593,7 +5709,7 @@ var withTrellis = (Viz) => {
|
|
|
5593
5709
|
}, [pageCount, trellisSplitBy]);
|
|
5594
5710
|
(0, react_exports.useEffect)(() => {
|
|
5595
5711
|
updateDataDisplay(pageNum);
|
|
5596
|
-
}, [columns, fields, trellisSplitBy, pageNum, splitByLayout]);
|
|
5712
|
+
}, [columns, fields, trellisSplitBy, trellisSortBy, trellisSortOrder, pageNum, splitByLayout]);
|
|
5597
5713
|
const handlePageChange = (0, react_exports.useCallback)(
|
|
5598
5714
|
(event, { page }) => {
|
|
5599
5715
|
setPageNum(page);
|
|
@@ -5601,9 +5717,7 @@ var withTrellis = (Viz) => {
|
|
|
5601
5717
|
[pageNum, pagedData]
|
|
5602
5718
|
);
|
|
5603
5719
|
const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
|
|
5604
|
-
const isTrellisFeatureFlagOn2 = Boolean(
|
|
5605
|
-
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
5606
|
-
);
|
|
5720
|
+
const isTrellisFeatureFlagOn2 = Boolean(featureFlagContext == null ? void 0 : featureFlagContext.visualizations_enableTrellis);
|
|
5607
5721
|
if (!isTrellisFeatureFlagOn2 || !splitByLayout || splitByLayout !== visualization_schemas_exports.LAYOUT_TYPE.Trellis) {
|
|
5608
5722
|
return /* @__PURE__ */ react_exports.createElement(Viz, __spreadValues({}, opts));
|
|
5609
5723
|
}
|
|
@@ -5611,14 +5725,9 @@ var withTrellis = (Viz) => {
|
|
|
5611
5725
|
if (noColumns || noFields) {
|
|
5612
5726
|
return /* @__PURE__ */ react_exports.createElement(Message_default, { width, height, message: (0, i18n_exports._)("Loading"), level: "info" });
|
|
5613
5727
|
}
|
|
5614
|
-
|
|
5615
|
-
if (!trellisSplitBy || trellisSplitBy.length === 0) {
|
|
5616
|
-
const splitByPossibleFields = (0, trellisUtils_exports.getAllPossibleSplitByFields)(fields);
|
|
5617
|
-
currTrellisSplitBy = splitByPossibleFields.fields && splitByPossibleFields.fields.length ? splitByPossibleFields.fields[0] : AGGREGATIONS;
|
|
5618
|
-
}
|
|
5619
|
-
const splitMode = (0, trellisUtils_exports.getTrellisDataSplitterMode)(fields);
|
|
5728
|
+
const currTrellisSplitBy = resolveTrellisSplitBy(trellisSplitBy, fields);
|
|
5620
5729
|
const dataSplitResult = getTrellisDataSourcesBySplitMode(
|
|
5621
|
-
|
|
5730
|
+
(0, trellisUtils_exports.getTrellisDataSplitterMode)(fields),
|
|
5622
5731
|
dataSources,
|
|
5623
5732
|
currTrellisSplitBy
|
|
5624
5733
|
);
|
|
@@ -5627,12 +5736,19 @@ var withTrellis = (Viz) => {
|
|
|
5627
5736
|
if (!modifiedDataSourceBySplitBy || Object.keys(modifiedDataSourceBySplitBy).length === 0 || dataSplitErrorCode) {
|
|
5628
5737
|
return showErrorMessage(dataSplitErrorCode, width, height);
|
|
5629
5738
|
}
|
|
5630
|
-
const splitByKeysModified =
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5739
|
+
const splitByKeysModified = Object.keys(modifiedDataSourceBySplitBy);
|
|
5740
|
+
const vizContext = (0, lodash_exports.defaultsDeep)({}, context, Viz.config.defaultContext);
|
|
5741
|
+
sortTrellisKeys(
|
|
5742
|
+
splitByKeysModified,
|
|
5743
|
+
trellisSortBy,
|
|
5744
|
+
trellisSortOrder,
|
|
5745
|
+
modifiedDataSourceBySplitBy,
|
|
5746
|
+
mergedOptions,
|
|
5747
|
+
vizContext
|
|
5748
|
+
);
|
|
5749
|
+
showPaginator = splitByKeysModified.length > pageCount;
|
|
5750
|
+
splitByKeys = splitByKeysModified;
|
|
5751
|
+
totalPages = Math.ceil(splitByKeysModified.length / pageCount);
|
|
5636
5752
|
const [calculatedMin, calculatedMax] = determineMinMax(
|
|
5637
5753
|
modifiedDataSourceBySplitBy,
|
|
5638
5754
|
trellisSharedScale,
|
|
@@ -5666,6 +5782,7 @@ var withTrellis = (Viz) => {
|
|
|
5666
5782
|
/* @__PURE__ */ react_exports.createElement(
|
|
5667
5783
|
Viz,
|
|
5668
5784
|
__spreadProps(__spreadValues({}, otherProps), {
|
|
5785
|
+
context,
|
|
5669
5786
|
trellisKey: splitByKey,
|
|
5670
5787
|
trellisSplitBy: currTrellisSplitBy,
|
|
5671
5788
|
dataSources: modifiedDataSourceBySplitBy[splitByKey],
|