@oracle/oraclejet-preact 20.0.3 → 20.0.4
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/amd/{BarChart-f429b382.js → BarChart-994cb8f0.js} +2 -2
- package/amd/{BarChart-f429b382.js.map → BarChart-994cb8f0.js.map} +1 -1
- package/amd/BaseCardView-16fda4c3.js +2 -0
- package/amd/{BaseCardView-b8119561.js.map → BaseCardView-16fda4c3.js.map} +1 -1
- package/amd/CardFlexView-d3eb7373.js +2 -0
- package/amd/{CardFlexView-aa2f3de8.js.map → CardFlexView-d3eb7373.js.map} +1 -1
- package/amd/CardGridView-842f70cd.js +2 -0
- package/amd/{CardGridView-85f90c75.js.map → CardGridView-842f70cd.js.map} +1 -1
- package/amd/{Chart-57965de4.js → Chart-d9eafc7a.js} +2 -2
- package/amd/{Chart-57965de4.js.map → Chart-d9eafc7a.js.map} +1 -1
- package/amd/CheckboxSetContext-2e486ea8.js +2 -0
- package/amd/CheckboxSetContext-2e486ea8.js.map +1 -0
- package/amd/{ComboChart-c42ed049.js → ComboChart-5a6f6c8a.js} +2 -2
- package/amd/{ComboChart-c42ed049.js.map → ComboChart-5a6f6c8a.js.map} +1 -1
- package/amd/{LineAreaChart-48efb7f7.js → LineAreaChart-47fc17d2.js} +2 -2
- package/amd/{LineAreaChart-48efb7f7.js.map → LineAreaChart-47fc17d2.js.map} +1 -1
- package/amd/ListView-02a92d18.js +2 -0
- package/amd/{ListView-2678b2af.js.map → ListView-02a92d18.js.map} +1 -1
- package/amd/NavigationListItem-9df5446c.js +2 -0
- package/amd/NavigationListItem-9df5446c.js.map +1 -0
- package/amd/NavigationListLinkItem-161049bb.js +2 -0
- package/amd/NavigationListLinkItem-161049bb.js.map +1 -0
- package/amd/{OverflowTabBar-f8bf9356.js → OverflowTabBar-5ff68da7.js} +2 -2
- package/amd/{OverflowTabBar-f8bf9356.js.map → OverflowTabBar-5ff68da7.js.map} +1 -1
- package/amd/OverflowTabBarItem-926b0c8a.js +2 -0
- package/amd/{OverflowTabBarItem-0aa39512.js.map → OverflowTabBarItem-926b0c8a.js.map} +1 -1
- package/amd/PRIVATE_BaseCardView.js +1 -1
- package/amd/PRIVATE_Chart.js +1 -1
- package/amd/PRIVATE_TableList.js +1 -1
- package/amd/RemovableNavigationListItem-e298c5de.js +2 -0
- package/amd/{RemovableNavigationListItem-60593d4c.js.map → RemovableNavigationListItem-e298c5de.js.map} +1 -1
- package/amd/ReorderableTabBar-0c69bfd4.js +2 -0
- package/amd/{ReorderableTabBar-19a503c7.js.map → ReorderableTabBar-0c69bfd4.js.map} +1 -1
- package/amd/{ScatterChart-6427e7ec.js → ScatterChart-7bd0f601.js} +2 -2
- package/amd/{ScatterChart-6427e7ec.js.map → ScatterChart-7bd0f601.js.map} +1 -1
- package/amd/TabBar-de723fbc.js +2 -0
- package/amd/{TabBar-92bac52f.js.map → TabBar-de723fbc.js.map} +1 -1
- package/amd/TabBarMixed-cfd346bf.js +2 -0
- package/amd/{TabBarMixed-5b5a5047.js.map → TabBarMixed-cfd346bf.js.map} +1 -1
- package/amd/TextArea-4a3b8b56.js +2 -0
- package/amd/TextArea-4a3b8b56.js.map +1 -0
- package/amd/TextAreaAutosize-3a13ebb2.js +2 -0
- package/amd/{TextAreaAutosize-01dfd98e.js.map → TextAreaAutosize-3a13ebb2.js.map} +1 -1
- package/amd/Theme-redwood/theme.css +181 -181
- package/amd/Theme-stable/theme.css +182 -182
- package/amd/UNSAFE_BarChart/__test__/BarChart.spec.js +1 -1
- package/amd/UNSAFE_BarChart.js +1 -1
- package/amd/UNSAFE_CardFlexView.js +1 -1
- package/amd/UNSAFE_CardGridView.js +1 -1
- package/amd/UNSAFE_CheckboxItem.js +1 -1
- package/amd/UNSAFE_CheckboxItem.js.map +1 -1
- package/amd/UNSAFE_CheckboxSet.js +1 -1
- package/amd/UNSAFE_CheckboxSet.js.map +1 -1
- package/amd/UNSAFE_ComboChart.js +1 -1
- package/amd/UNSAFE_LineAreaChart.js +1 -1
- package/amd/UNSAFE_ListView.js +1 -1
- package/amd/UNSAFE_NavigationList.js +1 -1
- package/amd/UNSAFE_NavigationListCommon.js +1 -1
- package/amd/UNSAFE_OverflowTabBar.js +1 -1
- package/amd/UNSAFE_ReorderableTabBar.js +1 -1
- package/amd/UNSAFE_RichCheckboxSet.js +1 -1
- package/amd/UNSAFE_RichCheckboxSet.js.map +1 -1
- package/amd/UNSAFE_RichSelectionItem.js +1 -1
- package/amd/UNSAFE_RichSelectionItem.js.map +1 -1
- package/amd/UNSAFE_ScatterChart.js +1 -1
- package/amd/UNSAFE_TabBar.js +1 -1
- package/amd/UNSAFE_TabBarCommon.js +1 -1
- package/amd/UNSAFE_TabBarMixed.js +1 -1
- package/amd/UNSAFE_TextArea.js +1 -1
- package/amd/UNSAFE_TextAreaAutosize.js +1 -1
- package/amd/useTextAreaAltEnter-32272da6.js +2 -0
- package/amd/useTextAreaAltEnter-32272da6.js.map +1 -0
- package/cjs/{NavigationList-d0d74565.js → NavigationListItem-3b9eb0fb.js} +8 -21
- package/cjs/NavigationListItem-3b9eb0fb.js.map +1 -0
- package/cjs/{NavigationListLinkItem-317a5200.js → NavigationListLinkItem-62c3912e.js} +99 -8
- package/cjs/NavigationListLinkItem-62c3912e.js.map +1 -0
- package/cjs/{OverflowTabBarItem-19ad4971.js → OverflowTabBarItem-abcd2327.js} +4 -6
- package/cjs/{OverflowTabBarItem-19ad4971.js.map → OverflowTabBarItem-abcd2327.js.map} +1 -1
- package/cjs/{TabBar-d84e222e.js → TabBar-4bc753a9.js} +1 -7
- package/{es/TabBar-67ca442c.js.map → cjs/TabBar-4bc753a9.js.map} +1 -1
- package/cjs/{TabBarLinkItem-e924f83b.js → TabBarLinkItem-b0c4b100.js} +2 -2
- package/cjs/{TabBarLinkItem-e924f83b.js.map → TabBarLinkItem-b0c4b100.js.map} +1 -1
- package/cjs/Theme-redwood/theme.css +130 -130
- package/cjs/Theme-stable/theme.css +220 -220
- package/cjs/UNSAFE_NavigationList.js +15 -17
- package/cjs/UNSAFE_NavigationList.js.map +1 -1
- package/cjs/UNSAFE_NavigationListCommon.js +13 -14
- package/cjs/UNSAFE_NavigationListCommon.js.map +1 -1
- package/cjs/UNSAFE_OverflowTabBar.js +59 -62
- package/cjs/UNSAFE_OverflowTabBar.js.map +1 -1
- package/cjs/UNSAFE_ReorderableTabBar.js +19 -32
- package/cjs/UNSAFE_ReorderableTabBar.js.map +1 -1
- package/cjs/UNSAFE_TabBar.js +60 -63
- package/cjs/UNSAFE_TabBar.js.map +1 -1
- package/cjs/UNSAFE_TabBarCommon.js +75 -78
- package/cjs/UNSAFE_TabBarCommon.js.map +1 -1
- package/cjs/UNSAFE_TabBarMixed.js +33 -36
- package/cjs/UNSAFE_TabBarMixed.js.map +1 -1
- package/es/{BaseCardView-b3d8bae0.js → BaseCardView-85b9a71e.js} +1 -4
- package/es/{BaseCardView-b3d8bae0.js.map → BaseCardView-85b9a71e.js.map} +1 -1
- package/es/ButtonLayoutVariants.styles.css +2 -2
- package/es/ButtonLayoutVariants.styles2.css +2 -2
- package/es/CheckboxSetContext-1be56556.js +9 -0
- package/es/CheckboxSetContext-1be56556.js.map +1 -0
- package/es/{ColorPicker-ae648c4c.js → ColorPicker-fa103067.js} +2 -2
- package/es/{ColorPicker-ae648c4c.js.map → ColorPicker-fa103067.js.map} +1 -1
- package/es/PRIVATE_BaseCardView.js +1 -1
- package/es/PRIVATE_CollapsibleNavigationList.js +25 -25
- package/es/PRIVATE_TableList.js +4 -4
- package/es/SegmentStyles.styles.css +12 -9
- package/es/SegmentStyles.styles2.css +9 -12
- package/es/{TabBar-67ca442c.js → TabBar-10488830.js} +1 -3
- package/{cjs/TabBar-d84e222e.js.map → es/TabBar-10488830.js.map} +1 -1
- package/es/Theme-redwood/theme.css +401 -401
- package/es/Theme-stable/theme.css +451 -451
- package/es/UNSAFE_ButtonLayout/themes/redwood/ButtonLayoutTheme.js +1 -1
- package/es/UNSAFE_ButtonLayout/themes/redwood/ButtonLayoutVariants.css.js +1 -1
- package/es/UNSAFE_ButtonLayout/themes/stable/ButtonLayoutTheme.js +1 -1
- package/es/UNSAFE_ButtonLayout/themes/stable/ButtonLayoutVariants.css.js +1 -1
- package/es/UNSAFE_ButtonLayout.js +1 -1
- package/es/UNSAFE_CardFlexView.js +1 -1
- package/es/UNSAFE_CardGridView.js +1 -1
- package/es/UNSAFE_CheckboxItem.js +61 -122
- package/es/UNSAFE_CheckboxItem.js.map +1 -1
- package/es/UNSAFE_CheckboxSet.js +49 -15
- package/es/UNSAFE_CheckboxSet.js.map +1 -1
- package/es/UNSAFE_ColorPicker.js +25 -25
- package/es/UNSAFE_FlatTreeView.js +14 -14
- package/es/UNSAFE_InputColor.js +2 -2
- package/es/UNSAFE_InputDateMask/themes/SegmentStyles.css.js +1 -1
- package/es/UNSAFE_InputDateMask.js +1 -1
- package/es/UNSAFE_InputDatePicker.js +1 -1
- package/es/UNSAFE_InputTimeMask/themes/SegmentStyles.css.js +1 -1
- package/es/UNSAFE_InputTimeMask.js +1 -1
- package/es/UNSAFE_ListView.js +53 -53
- package/es/UNSAFE_OverflowTabBar.js +10 -10
- package/es/UNSAFE_ReorderableTabBar.js +12 -12
- package/es/UNSAFE_RichCheckboxSet.js +42 -46
- package/es/UNSAFE_RichCheckboxSet.js.map +1 -1
- package/es/UNSAFE_RichSelectionItem.js +89 -152
- package/es/UNSAFE_RichSelectionItem.js.map +1 -1
- package/es/UNSAFE_TabBar.js +10 -10
- package/es/UNSAFE_TabBarMixed.js +8 -8
- package/es/UNSAFE_TextArea.js +226 -106
- package/es/UNSAFE_TextArea.js.map +1 -1
- package/es/UNSAFE_TextAreaAutosize.js +1 -1
- package/es/UNSAFE_Toolbar.js +1 -1
- package/es/useTextAreaAltEnter-ac460f4c.js +61 -0
- package/es/useTextAreaAltEnter-ac460f4c.js.map +1 -0
- package/package.json +2 -2
- package/amd/BaseCardView-b8119561.js +0 -2
- package/amd/CardFlexView-aa2f3de8.js +0 -2
- package/amd/CardGridView-85f90c75.js +0 -2
- package/amd/CheckboxSet-f000e5c2.js +0 -2
- package/amd/CheckboxSet-f000e5c2.js.map +0 -1
- package/amd/ListView-2678b2af.js +0 -2
- package/amd/NavigationList-a6bb123d.js +0 -2
- package/amd/NavigationList-a6bb123d.js.map +0 -1
- package/amd/NavigationListItem-10bf6656.js +0 -2
- package/amd/NavigationListItem-10bf6656.js.map +0 -1
- package/amd/NavigationListLinkItem-df1826e6.js +0 -2
- package/amd/NavigationListLinkItem-df1826e6.js.map +0 -1
- package/amd/OverflowTabBarItem-0aa39512.js +0 -2
- package/amd/RemovableNavigationListItem-60593d4c.js +0 -2
- package/amd/ReorderableTabBar-19a503c7.js +0 -2
- package/amd/TabBar-92bac52f.js +0 -2
- package/amd/TabBarMixed-5b5a5047.js +0 -2
- package/amd/TextArea-345f89d4.js +0 -2
- package/amd/TextArea-345f89d4.js.map +0 -1
- package/amd/TextAreaAutosize-01dfd98e.js +0 -2
- package/amd/useNavigationListItem-582f5564.js +0 -2
- package/amd/useNavigationListItem-582f5564.js.map +0 -1
- package/cjs/NavigationList-d0d74565.js.map +0 -1
- package/cjs/NavigationListItem-b0b03089.js +0 -12
- package/cjs/NavigationListItem-b0b03089.js.map +0 -1
- package/cjs/NavigationListLinkItem-317a5200.js.map +0 -1
- package/cjs/useNavigationListItem-b97e76d5.js +0 -104
- package/cjs/useNavigationListItem-b97e76d5.js.map +0 -1
- package/es/CheckboxSet-3aab5935.js +0 -51
- package/es/CheckboxSet-3aab5935.js.map +0 -1
- package/es/TextArea-93ce78a7.js +0 -225
- package/es/TextArea-93ce78a7.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboChart-c42ed049.js","sources":["../../src/UNSAFE_ComboChart/ComboChart.tsx"],"sourcesContent":["/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * Licensed under The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\n\nimport { ComboChartProps, LineAreaItem } from './ComboChart.types';\nimport {\n findNearestDataPoint,\n getStartAndEndAxesOffset\n} from '#utils/PRIVATE_chartUtils/layoutUtils';\nimport { AreaSeries } from '#PRIVATE_LineAreaComponents/AreaSeries';\nimport { getMarkers, getSeriesData } from '#utils/PRIVATE_chartUtils/utils';\nimport { MarkersWithLabel } from '#PRIVATE_Chart/MarkersWithLabel';\nimport { getLineAreaChartNavUtil } from '#utils/PRIVATE_chartUtils/navUtils';\nimport { Chart } from '#PRIVATE_Chart';\nimport { ChartSeriesData, Scale, SizeHandle, TimeAxisProps } from '#utils/UNSAFE_visTypes/chart';\nimport { useUser } from '#hooks/UNSAFE_useUser';\nimport { getColorRamp } from '#utils/UNSAFE_visUtils';\nimport { LineSeries } from '#PRIVATE_LineAreaComponents/LineSeries';\nimport { Point } from '#utils/PRIVATE_visSVGUtils';\nimport { getLineAreaSegments } from '#utils/PRIVATE_chartUtils/utils';\nimport { colorSchemeVars } from '@oracle/oraclejet-internal-theme-contract/themeContract.css';\nimport { getItemColor, getMarkerType } from '#utils/PRIVATE_chartUtils/dataStyleUtils';\nimport { BarGroup } from '#UNSAFE_BarChart/BarGroup';\nimport { getBarPosition } from '#UNSAFE_BarChart/utils/barLayoutUtils';\nimport { getLineAreaChartItemPosition } from '#PRIVATE_LineAreaComponents/utils/chartUtils';\nimport { getBarGapRatio } from '#UNSAFE_BarChart/utils/barSeriesUtils';\nimport { Ref, VNode } from 'preact';\nimport { forwardRef } from 'preact/compat';\n\nconst LINE_WITH_AREA_OPACITY = 0.2;\n\nexport type ForwardRefComboChart = <K extends string | number, D extends LineAreaItem<K>>(\n props: ComboChartProps<K, D> & {\n ref?: Ref<SizeHandle>;\n }\n) => VNode | null;\n\n/**\n * The ComboChart displays information graphically using bars, lines and filled areas, making relationships among the data easier to understand.\n */\nexport const ComboChart = forwardRef(\n <K extends string | number, D extends LineAreaItem<K>>(\n { width,\n height,\n selectedIds = [],\n hiddenIds = [],\n highlightedIds,\n hideAndShowBehavior = 'none',\n orientation = 'vertical',\n yAxis,\n series,\n groups,\n getDataItem,\n selectionMode = 'none',\n drilling = 'off',\n dataItemGaps = 0.5,\n dataLabelEffect = 'outline',\n stacking = 'off',\n ...props\n }: ComboChartProps<K, D>,\n ref: Ref<SizeHandle>\n ) => {\n const { direction, forcedColors } = useUser();\n const isHighContrast = forcedColors === 'active';\n const filteredBarSeries = series.filter((currentSeries) => currentSeries.type === 'bar');\n const isRtl = direction === 'rtl';\n const isLog = yAxis?.scale === 'log';\n const timeAxisType = (props.xAxis as TimeAxisProps)?.timeAxisType;\n const hiddenSet = new Set(hiddenIds);\n const selectedSet = new Set(selectedIds);\n const highlightedSet = new Set(highlightedIds);\n const isHoriz = orientation === 'horizontal';\n const colors = getColorRamp();\n // TODO: JET-71332 ; should only be (number | undefined)[][]\n // remove the type inference from scatter chart item.\n let renderedSeries = getSeriesData<K, D>(\n series.length,\n groups.length,\n getDataItem,\n hiddenSet,\n isLog\n );\n\n const isStacked = stacking != 'off';\n const stackLabelStyle = typeof stacking === 'string' ? undefined : stacking.stackLabelStyle;\n const getStackGroup =\n (stacking === 'on'\n ? (s: ChartSeriesData<K, D>) => s.id as string\n : stacking != 'off'\n ? stacking.getStackGroup\n : undefined) || (() => 'default');\n const getStackLabel =\n typeof stacking === 'object' && stacking.getStackLabel ? stacking.getStackLabel : undefined;\n\n const renderedGetDataItem = (seriesIndex: number, groupIndex: number): D | undefined => {\n if (!isStacked) return getDataItem(seriesIndex, groupIndex);\n return {\n ...getDataItem(seriesIndex, groupIndex),\n value: renderedSeries[seriesIndex][groupIndex]\n } as D;\n };\n\n const getGapRatio = () => {\n return 1;\n };\n\n const getNextChartItemFunc = (startIndex: number, endIndex: number) => {\n // TODO: JET-71332\n //@ts-ignore\n return getLineAreaChartNavUtil<D>(\n getDataItem,\n series.length,\n startIndex,\n endIndex,\n isStacked,\n isRtl,\n isHoriz\n );\n };\n const isSplitDualY = typeof props.y2Axis?.split === 'number';\n const getDataItemPos = (\n xScale: Scale,\n yScale: Scale,\n y2Scale: Scale,\n axisStepWidth: number,\n averageGroupZ: number,\n gapRatio: number\n ) => {\n const _getBarPosition = hasBar\n ? getBarPosition(\n filteredBarSeries,\n groups,\n getDataItem,\n xScale,\n yScale,\n y2Scale,\n hiddenSet,\n dataItemGaps,\n axisStepWidth,\n averageGroupZ,\n gapRatio,\n yAxis?.scale === 'log',\n isStacked,\n isRtl,\n isHoriz,\n isSplitDualY,\n getStackGroup,\n timeAxisType\n )\n : undefined;\n\n return (seriesIndex: number, groupIndex: number) => {\n const seriesItem = series[seriesIndex];\n if (seriesItem.type === 'bar') {\n return _getBarPosition ? _getBarPosition(seriesIndex, groupIndex) : undefined;\n } else {\n return getLineAreaChartItemPosition(\n seriesIndex,\n groupIndex,\n renderedSeries,\n getDataItem,\n groups,\n isHoriz,\n xScale,\n yScale,\n timeAxisType\n );\n }\n };\n };\n\n const getMarkerColorAndType = (seriesIndex: number, groupIndex: number) => {\n const color = getItemColor(seriesIndex, groupIndex, series, getDataItem);\n const markerType = getMarkerType(seriesIndex, groupIndex, getDataItem);\n return { color, markerType };\n };\n\n const findNearest = (xScale: Scale, yScale: Scale, y2Scale: Scale) => {\n const getSeriesDataInfo = () => {\n return {\n offset: 0,\n dataWidth: 0\n };\n };\n\n const getYCoord = (value: number, yScale: Scale) => {\n return yScale.transform(value);\n };\n\n return findNearestDataPoint<K, D>(\n series,\n groups,\n xScale,\n yScale,\n renderedGetDataItem,\n isStacked,\n getSeriesDataInfo,\n getYCoord,\n isLog,\n 0,\n hiddenSet,\n timeAxisType,\n y2Scale\n );\n };\n const markers = getMarkers();\n\n const allLineSegmentCoords: Point[][] = [];\n\n const { hasBar, hasCenteredSeries, hasUncenteredSeries, hasArea } = (\n series as { lineType: string; type: string }[]\n ).reduce(\n (acc, s) => {\n return {\n hasArea: acc.hasArea || s.type === 'area' || s.type === 'lineWithArea',\n hasBar: acc.hasBar || s.type === 'bar',\n hasCenteredSeries:\n acc.hasCenteredSeries ||\n s.lineType === 'centeredSegmented' ||\n s.lineType === 'centeredStepped',\n hasUncenteredSeries:\n acc.hasUncenteredSeries || s.lineType === 'segmented' || s.lineType === 'stepped'\n };\n },\n { hasBar: false, hasCenteredSeries: false, hasUncenteredSeries: false, hasArea: false }\n );\n\n const getOffset = (groupCount: number) => {\n return getStartAndEndAxesOffset(\n hasCenteredSeries,\n hasUncenteredSeries,\n isHoriz,\n groupCount,\n hasBar\n );\n };\n\n return (\n <Chart\n ref={ref}\n width={width}\n height={height}\n selectedIds={selectedSet}\n hiddenIds={hiddenIds}\n hideAndShowBehavior={hideAndShowBehavior}\n orientation={orientation}\n yAxis={yAxis}\n series={series}\n defaultOverviewContentRenderer={() => {\n return <OverviewComboChart groups={groups} series={series} getDataItem={getDataItem} />;\n }}\n groups={groups}\n selectionMode={selectionMode}\n drilling={drilling}\n isStacked={isStacked}\n getDataItem={getDataItem}\n findNearest={findNearest}\n getDataItemPos={getDataItemPos}\n getMarkerInfo={getMarkerColorAndType}\n renderGridLinesInFront={hasArea}\n getNavUtil={getNextChartItemFunc}\n getGapRatio={getGapRatio}\n getStartAndEndAxesOffset={getOffset}\n isRtl={isRtl}\n stackLabelStyle={stackLabelStyle}\n getStackGroup={getStackGroup}\n {...props}>\n {({\n xStartIndex,\n xEndIndex,\n xScale,\n groupsInfo,\n yScale,\n y2Scale,\n activeId,\n focusedItemInfo,\n hoveredItemInfo,\n isPointInsideMarquee,\n getTextDimensions,\n defaultFontSize,\n resolvedColors,\n axisStepWidth,\n averageGroupZ,\n getItemAriaLabel,\n plotAreaClipPathId\n }) => {\n let barSeriesIndex = -1;\n const leafGroups = groupsInfo.map(({ item }) => item);\n renderedSeries = getSeriesData<K, D>(\n series.length,\n leafGroups.length,\n getDataItem,\n hiddenSet,\n isLog\n );\n\n return (\n <>\n {renderedSeries.map((valueSeries, index) => {\n const currentSeries = series[index];\n const isAssociatedToY2 = currentSeries.associatedYAxis === 'y2';\n const areaOpacity =\n currentSeries.type === 'lineWithArea' ? LINE_WITH_AREA_OPACITY : 1;\n const isAreaRendered =\n currentSeries.type === 'area' || currentSeries.type === 'lineWithArea';\n const isContrastLineNeeded = currentSeries.type === 'area';\n\n if (valueSeries.length === 0) {\n return;\n }\n\n const lineSegmentCoords: Point[][] = getLineAreaSegments<K, D>(\n isAssociatedToY2 ? y2Scale : yScale,\n xScale,\n valueSeries,\n xStartIndex,\n xEndIndex,\n isLog,\n leafGroups,\n index,\n renderedGetDataItem,\n timeAxisType\n );\n allLineSegmentCoords[index] = lineSegmentCoords[0];\n const isBottomSegmentCurved =\n currentSeries.type !== 'bar'\n ? currentSeries.lineType === 'curved' &&\n isStacked &&\n renderedSeries.length > 1 &&\n index > 0\n : isStacked && renderedSeries.length > 1 && index > 0;\n\n const isHighlighted =\n highlightedIds === undefined ||\n highlightedSet.size === 0 ||\n highlightedSet.has(currentSeries.id);\n\n const prevCoords =\n isStacked && index != 0\n ? allLineSegmentCoords.reduce((prevValue, newValue, j) => {\n // find the index i such that i < index, and series i has at least\n // one or more data item unhidden. Only such series will can be\n // used as bottomCoord for current series. Otherwise we have to use\n // baseline coord\n if (j >= index) {\n return prevValue;\n }\n if (newValue.length > 0) {\n return j;\n }\n return prevValue;\n }, 0)\n : undefined;\n if (currentSeries.type === 'bar') barSeriesIndex = barSeriesIndex + 1;\n return (\n <>\n {currentSeries.type === 'bar' &&\n leafGroups.slice(xStartIndex, xEndIndex + 1).map((_, index) => {\n const barGroup = (\n <BarGroup\n plotAreaClipPathId={plotAreaClipPathId}\n yScale={yScale}\n y2Scale={y2Scale}\n xScale={xScale}\n splitDualY={isSplitDualY}\n groupIndex={index + xStartIndex}\n selectedIds={selectedSet}\n hiddenIds={hiddenSet}\n highlightedIds={highlightedIds ? highlightedSet : highlightedIds}\n isDrillEnabled={drilling === 'on'}\n series={filteredBarSeries}\n barGapRatio={getBarGapRatio(isStacked, xStartIndex, xEndIndex)}\n dataItemGaps={dataItemGaps}\n isPointInsideMarquee={isPointInsideMarquee}\n isStacked={isStacked}\n axisStepWidth={axisStepWidth}\n averageGroupZ={averageGroupZ!}\n group={leafGroups[index]}\n timeAxisType={(props.xAxis as TimeAxisProps)?.timeAxisType}\n colors={resolvedColors}\n activeId={activeId}\n isLog={yAxis?.scale === 'log'}\n orientation={orientation}\n getDataItem={getDataItem}\n isSelectionEnabled={selectionMode != 'none'}\n isRtl={isRtl}\n focusedItemInfo={focusedItemInfo}\n hoveredItemInfo={hoveredItemInfo}\n getTextDimensions={getTextDimensions}\n defaultFontSize={defaultFontSize}\n seriesIndex={barSeriesIndex}\n getItemAriaLabel={getItemAriaLabel}\n getStackLabel={getStackLabel}\n />\n );\n\n return barGroup;\n })}\n {isAreaRendered && (\n <AreaSeries\n yScale={isAssociatedToY2 ? y2Scale : yScale}\n plotAreaClipPathId={plotAreaClipPathId}\n lineType={currentSeries.lineType}\n color={currentSeries.areaColor || colors[index % colors.length]}\n isHorizontal={isHoriz}\n areaColorOpacity={areaOpacity}\n isBottomSegmentCurved={isBottomSegmentCurved}\n bottomCoords={\n prevCoords !== undefined &&\n allLineSegmentCoords[prevCoords].some((value) => value != null)\n ? allLineSegmentCoords[prevCoords]\n : undefined\n }\n lineSegments={lineSegmentCoords}\n isLog={isLog}\n isHighlighted={isHighlighted}\n seriesIndex={index}\n groupWidth={axisStepWidth}\n isRtl={isRtl}\n timeAxisType={timeAxisType}\n />\n )}\n {currentSeries.type === 'line' && (\n <LineSeries\n plotAreaClipPathId={plotAreaClipPathId}\n lineType={currentSeries.lineType}\n lineColor={\n isContrastLineNeeded\n ? colorSchemeVars.dvt.contrastLine\n : currentSeries.lineColor\n }\n lineWidth={isContrastLineNeeded ? 1.25 : currentSeries.lineWidth}\n lineStyle={currentSeries.lineStyle || 'solid'}\n color={currentSeries.lineColor || colors[index % colors.length]}\n lineSegmentCoords={lineSegmentCoords}\n isHorizontal={isHoriz}\n isHighlighted={isHighlighted}\n seriesIndex={index}\n groupWidth={axisStepWidth}\n isRtl={isRtl}\n timeAxisType={timeAxisType}\n />\n )}\n {\n /*for non stacked charts, markers should render in the order of series.\n some markers might get hidden behind area but this preserves the legacy behavior. */\n !isStacked && (currentSeries.type === 'line' || isAreaRendered) && (\n <MarkersWithLabel\n yScale={isAssociatedToY2 ? y2Scale : yScale}\n xScale={xScale}\n groups={leafGroups}\n series={currentSeries}\n timeAxisType={timeAxisType}\n color={\n colors[\n index % colors.length\n ] /* TODO : make this use getItemColor function from dataStyleUtils. */\n }\n seriesIndex={index}\n startIndex={xStartIndex}\n endIndex={xEndIndex}\n markerType={markers[index % markers.length]}\n orientation={orientation}\n isLog={isLog}\n activeId={activeId}\n getDataItem={getDataItem}\n isPointInsideMarquee={isPointInsideMarquee}\n selectedIds={selectedSet}\n focusedItemIndex={\n focusedItemInfo.seriesIndex === index &&\n focusedItemInfo.isFocusVisible &&\n !(props.isDataCursorEnabled && props.dataCursorStyle?.isMarkerDisplayed)\n ? focusedItemInfo.groupIndex\n : undefined\n }\n hoveredItemIndex={\n hoveredItemInfo?.isCurrent && hoveredItemInfo.seriesIndex === index\n ? hoveredItemInfo.groupIndex\n : undefined\n }\n isSelectionEnabled={\n selectionMode === 'single' || selectionMode === 'multiple'\n }\n isDrillEnabled={drilling === 'on'}\n defaultFontSize={defaultFontSize}\n dataLabelEffect={dataLabelEffect}\n isHighContrast={isHighContrast}\n getItemAriaLabel={getItemAriaLabel}\n isRtl={isRtl}\n />\n )\n }\n </>\n );\n })}\n </>\n //TODO - handle isStack part\n );\n }}\n </Chart>\n );\n }) as ForwardRefComboChart\n\nfunction OverviewComboChart<K extends string | number, D extends LineAreaItem<K>>(\n props: ComboChartProps<K, D>\n) {\n return (\n <ComboChart\n datatip={() => ({ content: '' })}\n zoomAndScroll=\"off\"\n plotArea={{\n yMajorTick: {\n isRendered: false\n },\n xMajorTick: {}\n }}\n xAxis={{\n tickLabel: {\n autoRotate: false,\n // @ts-ignore\n isRendered: props.xAxis?.timeAxisType ? true : false\n }\n }}\n series={props.series}\n groups={props.groups}\n getDataItem={props.getDataItem}\n yAxis={{\n tickLabel: {\n isRendered: false\n }\n }}\n overview=\"off\"\n />\n );\n}\n"],"names":["ComboChart","forwardRef","width","height","selectedIds","hiddenIds","highlightedIds","hideAndShowBehavior","orientation","yAxis","series","groups","getDataItem","selectionMode","drilling","dataItemGaps","dataLabelEffect","stacking","props","ref","direction","forcedColors","useUser","isHighContrast","filteredBarSeries","filter","currentSeries","type","isRtl","isLog","scale","timeAxisType","xAxis","hiddenSet","Set","selectedSet","highlightedSet","isHoriz","colors","getColorRamp","renderedSeries","getSeriesData","length","isStacked","stackLabelStyle","undefined","getStackGroup","s","id","getStackLabel","renderedGetDataItem","seriesIndex","groupIndex","value","isSplitDualY","y2Axis","split","markers","getMarkers","allLineSegmentCoords","hasBar","hasCenteredSeries","hasUncenteredSeries","hasArea","reduce","acc","lineType","_jsx","Chart","defaultOverviewContentRenderer","jsx","OverviewComboChart","findNearest","xScale","yScale","y2Scale","findNearestDataPoint","offset","dataWidth","transform","getDataItemPos","axisStepWidth","averageGroupZ","gapRatio","_getBarPosition","getBarPosition","getLineAreaChartItemPosition","getMarkerInfo","color","getItemColor","markerType","getMarkerType","renderGridLinesInFront","getNavUtil","startIndex","endIndex","getLineAreaChartNavUtil","getGapRatio","getStartAndEndAxesOffset","groupCount","children","xStartIndex","xEndIndex","groupsInfo","activeId","focusedItemInfo","hoveredItemInfo","isPointInsideMarquee","getTextDimensions","defaultFontSize","resolvedColors","getItemAriaLabel","plotAreaClipPathId","barSeriesIndex","leafGroups","map","item","_Fragment","Fragment","valueSeries","index","isAssociatedToY2","associatedYAxis","areaOpacity","isAreaRendered","isContrastLineNeeded","lineSegmentCoords","getLineAreaSegments","isBottomSegmentCurved","isHighlighted","size","has","prevCoords","prevValue","newValue","j","_jsxs","slice","_","BarGroup","splitDualY","isDrillEnabled","barGapRatio","getBarGapRatio","group","isSelectionEnabled","AreaSeries","areaColor","isHorizontal","areaColorOpacity","bottomCoords","some","lineSegments","groupWidth","LineSeries","lineColor","colorSchemeVars","dvt","contrastLine","lineWidth","lineStyle","MarkersWithLabel","focusedItemIndex","isFocusVisible","isDataCursorEnabled","dataCursorStyle","isMarkerDisplayed","hoveredItemIndex","isCurrent","datatip","content","zoomAndScroll","plotArea","yMajorTick","isRendered","xMajorTick","tickLabel","autoRotate","overview"],"mappings":"2XAiCA,MAWaA,EAAaC,EAAUA,YAClC,EACIC,QACAC,SACAC,cAAc,GACdC,YAAY,GACZC,iBACAC,sBAAsB,OACtBC,cAAc,WACdC,QACAC,SACAC,SACAC,cACAC,gBAAgB,OAChBC,WAAW,MACXC,eAAe,GACfC,kBAAkB,UAClBC,WAAW,SACRC,GAELC,KAEA,MAAMC,UAAEA,EAASC,aAAEA,GAAiBC,EAAOA,UACrCC,EAAkC,WAAjBF,EACjBG,EAAoBd,EAAOe,QAAQC,GAAyC,QAAvBA,EAAcC,OACnEC,EAAsB,QAAdR,EACRS,EAAyB,QAAjBpB,GAAOqB,MACfC,EAAgBb,EAAMc,OAAyBD,aAC/CE,EAAY,IAAIC,IAAI7B,GACpB8B,EAAc,IAAID,IAAI9B,GACtBgC,EAAiB,IAAIF,IAAI5B,GACzB+B,EAA0B,eAAhB7B,EACV8B,EAASC,EAAAA,eAGf,IAAIC,EAAiBC,gBACnB/B,EAAOgC,OACP/B,EAAO+B,OACP9B,EACAqB,EACAJ,GAGF,MAAMc,EAAwB,OAAZ1B,EACZ2B,EAAsC,iBAAb3B,OAAwB4B,EAAY5B,EAAS2B,gBACtEE,GACU,OAAb7B,EACI8B,GAA6BA,EAAEC,GACpB,OAAZ/B,EACEA,EAAS6B,mBACTD,IAAS,KAAY,WACvBI,EACgB,iBAAbhC,GAAyBA,EAASgC,cAAgBhC,EAASgC,mBAAgBJ,EAE9EK,EAAsB,CAACC,EAAqBC,IAC3CT,EACE,IACF/B,EAAYuC,EAAaC,GAC5BC,MAAOb,EAAeW,GAAaC,IAHdxC,EAAYu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pClC,YAAaA,EACbqB,MAAOA,EACP2E,SAAUA,EACV5F,YAAaA,EACb+F,qBAAsBA,EACtBvG,YAAa+B,EACb+H,iBACEzD,EAAgBtD,cAAgBqE,IAC9Bf,EAAgB0D,gBACdjJ,EAAMkJ,qBAAuBlJ,EAAMmJ,iBAAiBC,uBAEpDzH,EADA4D,EAAgBrD,WAGtBmH,iBACE7D,GAAiB8D,WAAa9D,EAAgBvD,cAAgBqE,EAC1Dd,EAAgBtD,gBAChBP,EAENoG,mBACoB,WAAlBpI,GAAgD,aAAlBA,EAEhCgI,eAA6B,OAAb/H,EAChB+F,gBAAiBA,EACjB7F,gBAAiBA,EACjBO,eAAgBA,EAChBwF,iBAAkBA,EAClBnF,MAAOA,MAKf,KAIN,GAGN,IAGN,SAAS2C,EACPrD,GAEA,OACEiD,MAACnE,EAAU,CACTyK,QAAS,KAAO,CAAEC,QAAS,KAC3BC,cAAc,MACdC,SAAU,CACRC,WAAY,CACVC,YAAY,GAEdC,WAAY,CAAE,GAEhB/I,MAAO,CACLgJ,UAAW,CACTC,YAAY,EAEZH,aAAY5J,EAAMc,OAAOD,eAG7BrB,OAAQQ,EAAMR,OACdC,OAAQO,EAAMP,OACdC,YAAaM,EAAMN,YACnBH,MAAO,CACLuK,UAAW,CACTF,YAAY,IAGhBI,SAAS,OAGf"}
|
|
1
|
+
{"version":3,"file":"ComboChart-5a6f6c8a.js","sources":["../../src/UNSAFE_ComboChart/ComboChart.tsx"],"sourcesContent":["/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * Licensed under The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\n\nimport { ComboChartProps, LineAreaItem } from './ComboChart.types';\nimport {\n findNearestDataPoint,\n getStartAndEndAxesOffset\n} from '#utils/PRIVATE_chartUtils/layoutUtils';\nimport { AreaSeries } from '#PRIVATE_LineAreaComponents/AreaSeries';\nimport { getMarkers, getSeriesData } from '#utils/PRIVATE_chartUtils/utils';\nimport { MarkersWithLabel } from '#PRIVATE_Chart/MarkersWithLabel';\nimport { getLineAreaChartNavUtil } from '#utils/PRIVATE_chartUtils/navUtils';\nimport { Chart } from '#PRIVATE_Chart';\nimport { ChartSeriesData, Scale, SizeHandle, TimeAxisProps } from '#utils/UNSAFE_visTypes/chart';\nimport { useUser } from '#hooks/UNSAFE_useUser';\nimport { getColorRamp } from '#utils/UNSAFE_visUtils';\nimport { LineSeries } from '#PRIVATE_LineAreaComponents/LineSeries';\nimport { Point } from '#utils/PRIVATE_visSVGUtils';\nimport { getLineAreaSegments } from '#utils/PRIVATE_chartUtils/utils';\nimport { colorSchemeVars } from '@oracle/oraclejet-internal-theme-contract/themeContract.css';\nimport { getItemColor, getMarkerType } from '#utils/PRIVATE_chartUtils/dataStyleUtils';\nimport { BarGroup } from '#UNSAFE_BarChart/BarGroup';\nimport { getBarPosition } from '#UNSAFE_BarChart/utils/barLayoutUtils';\nimport { getLineAreaChartItemPosition } from '#PRIVATE_LineAreaComponents/utils/chartUtils';\nimport { getBarGapRatio } from '#UNSAFE_BarChart/utils/barSeriesUtils';\nimport { Ref, VNode } from 'preact';\nimport { forwardRef } from 'preact/compat';\n\nconst LINE_WITH_AREA_OPACITY = 0.2;\n\nexport type ForwardRefComboChart = <K extends string | number, D extends LineAreaItem<K>>(\n props: ComboChartProps<K, D> & {\n ref?: Ref<SizeHandle>;\n }\n) => VNode | null;\n\n/**\n * The ComboChart displays information graphically using bars, lines and filled areas, making relationships among the data easier to understand.\n */\nexport const ComboChart = forwardRef(\n <K extends string | number, D extends LineAreaItem<K>>(\n { width,\n height,\n selectedIds = [],\n hiddenIds = [],\n highlightedIds,\n hideAndShowBehavior = 'none',\n orientation = 'vertical',\n yAxis,\n series,\n groups,\n getDataItem,\n selectionMode = 'none',\n drilling = 'off',\n dataItemGaps = 0.5,\n dataLabelEffect = 'outline',\n stacking = 'off',\n ...props\n }: ComboChartProps<K, D>,\n ref: Ref<SizeHandle>\n ) => {\n const { direction, forcedColors } = useUser();\n const isHighContrast = forcedColors === 'active';\n const filteredBarSeries = series.filter((currentSeries) => currentSeries.type === 'bar');\n const isRtl = direction === 'rtl';\n const isLog = yAxis?.scale === 'log';\n const timeAxisType = (props.xAxis as TimeAxisProps)?.timeAxisType;\n const hiddenSet = new Set(hiddenIds);\n const selectedSet = new Set(selectedIds);\n const highlightedSet = new Set(highlightedIds);\n const isHoriz = orientation === 'horizontal';\n const colors = getColorRamp();\n // TODO: JET-71332 ; should only be (number | undefined)[][]\n // remove the type inference from scatter chart item.\n let renderedSeries = getSeriesData<K, D>(\n series.length,\n groups.length,\n getDataItem,\n hiddenSet,\n isLog\n );\n\n const isStacked = stacking != 'off';\n const stackLabelStyle = typeof stacking === 'string' ? undefined : stacking.stackLabelStyle;\n const getStackGroup =\n (stacking === 'on'\n ? (s: ChartSeriesData<K, D>) => s.id as string\n : stacking != 'off'\n ? stacking.getStackGroup\n : undefined) || (() => 'default');\n const getStackLabel =\n typeof stacking === 'object' && stacking.getStackLabel ? stacking.getStackLabel : undefined;\n\n const renderedGetDataItem = (seriesIndex: number, groupIndex: number): D | undefined => {\n if (!isStacked) return getDataItem(seriesIndex, groupIndex);\n return {\n ...getDataItem(seriesIndex, groupIndex),\n value: renderedSeries[seriesIndex][groupIndex]\n } as D;\n };\n\n const getGapRatio = () => {\n return 1;\n };\n\n const getNextChartItemFunc = (startIndex: number, endIndex: number) => {\n // TODO: JET-71332\n //@ts-ignore\n return getLineAreaChartNavUtil<D>(\n getDataItem,\n series.length,\n startIndex,\n endIndex,\n isStacked,\n isRtl,\n isHoriz\n );\n };\n const isSplitDualY = typeof props.y2Axis?.split === 'number';\n const getDataItemPos = (\n xScale: Scale,\n yScale: Scale,\n y2Scale: Scale,\n axisStepWidth: number,\n averageGroupZ: number,\n gapRatio: number\n ) => {\n const _getBarPosition = hasBar\n ? getBarPosition(\n filteredBarSeries,\n groups,\n getDataItem,\n xScale,\n yScale,\n y2Scale,\n hiddenSet,\n dataItemGaps,\n axisStepWidth,\n averageGroupZ,\n gapRatio,\n yAxis?.scale === 'log',\n isStacked,\n isRtl,\n isHoriz,\n isSplitDualY,\n getStackGroup,\n timeAxisType\n )\n : undefined;\n\n return (seriesIndex: number, groupIndex: number) => {\n const seriesItem = series[seriesIndex];\n if (seriesItem.type === 'bar') {\n return _getBarPosition ? _getBarPosition(seriesIndex, groupIndex) : undefined;\n } else {\n return getLineAreaChartItemPosition(\n seriesIndex,\n groupIndex,\n renderedSeries,\n getDataItem,\n groups,\n isHoriz,\n xScale,\n yScale,\n timeAxisType\n );\n }\n };\n };\n\n const getMarkerColorAndType = (seriesIndex: number, groupIndex: number) => {\n const color = getItemColor(seriesIndex, groupIndex, series, getDataItem);\n const markerType = getMarkerType(seriesIndex, groupIndex, getDataItem);\n return { color, markerType };\n };\n\n const findNearest = (xScale: Scale, yScale: Scale, y2Scale: Scale) => {\n const getSeriesDataInfo = () => {\n return {\n offset: 0,\n dataWidth: 0\n };\n };\n\n const getYCoord = (value: number, yScale: Scale) => {\n return yScale.transform(value);\n };\n\n return findNearestDataPoint<K, D>(\n series,\n groups,\n xScale,\n yScale,\n renderedGetDataItem,\n isStacked,\n getSeriesDataInfo,\n getYCoord,\n isLog,\n 0,\n hiddenSet,\n timeAxisType,\n y2Scale\n );\n };\n const markers = getMarkers();\n\n const allLineSegmentCoords: Point[][] = [];\n\n const { hasBar, hasCenteredSeries, hasUncenteredSeries, hasArea } = (\n series as { lineType: string; type: string }[]\n ).reduce(\n (acc, s) => {\n return {\n hasArea: acc.hasArea || s.type === 'area' || s.type === 'lineWithArea',\n hasBar: acc.hasBar || s.type === 'bar',\n hasCenteredSeries:\n acc.hasCenteredSeries ||\n s.lineType === 'centeredSegmented' ||\n s.lineType === 'centeredStepped',\n hasUncenteredSeries:\n acc.hasUncenteredSeries || s.lineType === 'segmented' || s.lineType === 'stepped'\n };\n },\n { hasBar: false, hasCenteredSeries: false, hasUncenteredSeries: false, hasArea: false }\n );\n\n const getOffset = (groupCount: number) => {\n return getStartAndEndAxesOffset(\n hasCenteredSeries,\n hasUncenteredSeries,\n isHoriz,\n groupCount,\n hasBar\n );\n };\n\n return (\n <Chart\n ref={ref}\n width={width}\n height={height}\n selectedIds={selectedSet}\n hiddenIds={hiddenIds}\n hideAndShowBehavior={hideAndShowBehavior}\n orientation={orientation}\n yAxis={yAxis}\n series={series}\n defaultOverviewContentRenderer={() => {\n return <OverviewComboChart groups={groups} series={series} getDataItem={getDataItem} />;\n }}\n groups={groups}\n selectionMode={selectionMode}\n drilling={drilling}\n isStacked={isStacked}\n getDataItem={getDataItem}\n findNearest={findNearest}\n getDataItemPos={getDataItemPos}\n getMarkerInfo={getMarkerColorAndType}\n renderGridLinesInFront={hasArea}\n getNavUtil={getNextChartItemFunc}\n getGapRatio={getGapRatio}\n getStartAndEndAxesOffset={getOffset}\n isRtl={isRtl}\n stackLabelStyle={stackLabelStyle}\n getStackGroup={getStackGroup}\n {...props}>\n {({\n xStartIndex,\n xEndIndex,\n xScale,\n groupsInfo,\n yScale,\n y2Scale,\n activeId,\n focusedItemInfo,\n hoveredItemInfo,\n isPointInsideMarquee,\n getTextDimensions,\n defaultFontSize,\n resolvedColors,\n axisStepWidth,\n averageGroupZ,\n getItemAriaLabel,\n plotAreaClipPathId\n }) => {\n let barSeriesIndex = -1;\n const leafGroups = groupsInfo.map(({ item }) => item);\n renderedSeries = getSeriesData<K, D>(\n series.length,\n leafGroups.length,\n getDataItem,\n hiddenSet,\n isLog\n );\n\n return (\n <>\n {renderedSeries.map((valueSeries, index) => {\n const currentSeries = series[index];\n const isAssociatedToY2 = currentSeries.associatedYAxis === 'y2';\n const areaOpacity =\n currentSeries.type === 'lineWithArea' ? LINE_WITH_AREA_OPACITY : 1;\n const isAreaRendered =\n currentSeries.type === 'area' || currentSeries.type === 'lineWithArea';\n const isContrastLineNeeded = currentSeries.type === 'area';\n\n if (valueSeries.length === 0) {\n return;\n }\n\n const lineSegmentCoords: Point[][] = getLineAreaSegments<K, D>(\n isAssociatedToY2 ? y2Scale : yScale,\n xScale,\n valueSeries,\n xStartIndex,\n xEndIndex,\n isLog,\n leafGroups,\n index,\n renderedGetDataItem,\n timeAxisType\n );\n allLineSegmentCoords[index] = lineSegmentCoords[0];\n const isBottomSegmentCurved =\n currentSeries.type !== 'bar'\n ? currentSeries.lineType === 'curved' &&\n isStacked &&\n renderedSeries.length > 1 &&\n index > 0\n : isStacked && renderedSeries.length > 1 && index > 0;\n\n const isHighlighted =\n highlightedIds === undefined ||\n highlightedSet.size === 0 ||\n highlightedSet.has(currentSeries.id);\n\n const prevCoords =\n isStacked && index != 0\n ? allLineSegmentCoords.reduce((prevValue, newValue, j) => {\n // find the index i such that i < index, and series i has at least\n // one or more data item unhidden. Only such series will can be\n // used as bottomCoord for current series. Otherwise we have to use\n // baseline coord\n if (j >= index) {\n return prevValue;\n }\n if (newValue.length > 0) {\n return j;\n }\n return prevValue;\n }, 0)\n : undefined;\n if (currentSeries.type === 'bar') barSeriesIndex = barSeriesIndex + 1;\n return (\n <>\n {currentSeries.type === 'bar' &&\n leafGroups.slice(xStartIndex, xEndIndex + 1).map((_, index) => {\n const barGroup = (\n <BarGroup\n plotAreaClipPathId={plotAreaClipPathId}\n yScale={yScale}\n y2Scale={y2Scale}\n xScale={xScale}\n splitDualY={isSplitDualY}\n groupIndex={index + xStartIndex}\n selectedIds={selectedSet}\n hiddenIds={hiddenSet}\n highlightedIds={highlightedIds ? highlightedSet : highlightedIds}\n isDrillEnabled={drilling === 'on'}\n series={filteredBarSeries}\n barGapRatio={getBarGapRatio(isStacked, xStartIndex, xEndIndex)}\n dataItemGaps={dataItemGaps}\n isPointInsideMarquee={isPointInsideMarquee}\n isStacked={isStacked}\n axisStepWidth={axisStepWidth}\n averageGroupZ={averageGroupZ!}\n group={leafGroups[index]}\n timeAxisType={(props.xAxis as TimeAxisProps)?.timeAxisType}\n colors={resolvedColors}\n activeId={activeId}\n isLog={yAxis?.scale === 'log'}\n orientation={orientation}\n getDataItem={getDataItem}\n isSelectionEnabled={selectionMode != 'none'}\n isRtl={isRtl}\n focusedItemInfo={focusedItemInfo}\n hoveredItemInfo={hoveredItemInfo}\n getTextDimensions={getTextDimensions}\n defaultFontSize={defaultFontSize}\n seriesIndex={barSeriesIndex}\n getItemAriaLabel={getItemAriaLabel}\n getStackLabel={getStackLabel}\n />\n );\n\n return barGroup;\n })}\n {isAreaRendered && (\n <AreaSeries\n yScale={isAssociatedToY2 ? y2Scale : yScale}\n plotAreaClipPathId={plotAreaClipPathId}\n lineType={currentSeries.lineType}\n color={currentSeries.areaColor || colors[index % colors.length]}\n isHorizontal={isHoriz}\n areaColorOpacity={areaOpacity}\n isBottomSegmentCurved={isBottomSegmentCurved}\n bottomCoords={\n prevCoords !== undefined &&\n allLineSegmentCoords[prevCoords].some((value) => value != null)\n ? allLineSegmentCoords[prevCoords]\n : undefined\n }\n lineSegments={lineSegmentCoords}\n isLog={isLog}\n isHighlighted={isHighlighted}\n seriesIndex={index}\n groupWidth={axisStepWidth}\n isRtl={isRtl}\n timeAxisType={timeAxisType}\n />\n )}\n {currentSeries.type === 'line' && (\n <LineSeries\n plotAreaClipPathId={plotAreaClipPathId}\n lineType={currentSeries.lineType}\n lineColor={\n isContrastLineNeeded\n ? colorSchemeVars.dvt.contrastLine\n : currentSeries.lineColor\n }\n lineWidth={isContrastLineNeeded ? 1.25 : currentSeries.lineWidth}\n lineStyle={currentSeries.lineStyle || 'solid'}\n color={currentSeries.lineColor || colors[index % colors.length]}\n lineSegmentCoords={lineSegmentCoords}\n isHorizontal={isHoriz}\n isHighlighted={isHighlighted}\n seriesIndex={index}\n groupWidth={axisStepWidth}\n isRtl={isRtl}\n timeAxisType={timeAxisType}\n />\n )}\n {\n /*for non stacked charts, markers should render in the order of series.\n some markers might get hidden behind area but this preserves the legacy behavior. */\n !isStacked && (currentSeries.type === 'line' || isAreaRendered) && (\n <MarkersWithLabel\n yScale={isAssociatedToY2 ? y2Scale : yScale}\n xScale={xScale}\n groups={leafGroups}\n series={currentSeries}\n timeAxisType={timeAxisType}\n color={\n colors[\n index % colors.length\n ] /* TODO : make this use getItemColor function from dataStyleUtils. */\n }\n seriesIndex={index}\n startIndex={xStartIndex}\n endIndex={xEndIndex}\n markerType={markers[index % markers.length]}\n orientation={orientation}\n isLog={isLog}\n activeId={activeId}\n getDataItem={getDataItem}\n isPointInsideMarquee={isPointInsideMarquee}\n selectedIds={selectedSet}\n focusedItemIndex={\n focusedItemInfo.seriesIndex === index &&\n focusedItemInfo.isFocusVisible &&\n !(props.isDataCursorEnabled && props.dataCursorStyle?.isMarkerDisplayed)\n ? focusedItemInfo.groupIndex\n : undefined\n }\n hoveredItemIndex={\n hoveredItemInfo?.isCurrent && hoveredItemInfo.seriesIndex === index\n ? hoveredItemInfo.groupIndex\n : undefined\n }\n isSelectionEnabled={\n selectionMode === 'single' || selectionMode === 'multiple'\n }\n isDrillEnabled={drilling === 'on'}\n defaultFontSize={defaultFontSize}\n dataLabelEffect={dataLabelEffect}\n isHighContrast={isHighContrast}\n getItemAriaLabel={getItemAriaLabel}\n isRtl={isRtl}\n />\n )\n }\n </>\n );\n })}\n </>\n //TODO - handle isStack part\n );\n }}\n </Chart>\n );\n }) as ForwardRefComboChart\n\nfunction OverviewComboChart<K extends string | number, D extends LineAreaItem<K>>(\n props: ComboChartProps<K, D>\n) {\n return (\n <ComboChart\n datatip={() => ({ content: '' })}\n zoomAndScroll=\"off\"\n plotArea={{\n yMajorTick: {\n isRendered: false\n },\n xMajorTick: {}\n }}\n xAxis={{\n tickLabel: {\n autoRotate: false,\n // @ts-ignore\n isRendered: props.xAxis?.timeAxisType ? true : false\n }\n }}\n series={props.series}\n groups={props.groups}\n getDataItem={props.getDataItem}\n yAxis={{\n tickLabel: {\n isRendered: false\n }\n }}\n overview=\"off\"\n />\n );\n}\n"],"names":["ComboChart","forwardRef","width","height","selectedIds","hiddenIds","highlightedIds","hideAndShowBehavior","orientation","yAxis","series","groups","getDataItem","selectionMode","drilling","dataItemGaps","dataLabelEffect","stacking","props","ref","direction","forcedColors","useUser","isHighContrast","filteredBarSeries","filter","currentSeries","type","isRtl","isLog","scale","timeAxisType","xAxis","hiddenSet","Set","selectedSet","highlightedSet","isHoriz","colors","getColorRamp","renderedSeries","getSeriesData","length","isStacked","stackLabelStyle","undefined","getStackGroup","s","id","getStackLabel","renderedGetDataItem","seriesIndex","groupIndex","value","isSplitDualY","y2Axis","split","markers","getMarkers","allLineSegmentCoords","hasBar","hasCenteredSeries","hasUncenteredSeries","hasArea","reduce","acc","lineType","_jsx","Chart","defaultOverviewContentRenderer","jsx","OverviewComboChart","findNearest","xScale","yScale","y2Scale","findNearestDataPoint","offset","dataWidth","transform","getDataItemPos","axisStepWidth","averageGroupZ","gapRatio","_getBarPosition","getBarPosition","getLineAreaChartItemPosition","getMarkerInfo","color","getItemColor","markerType","getMarkerType","renderGridLinesInFront","getNavUtil","startIndex","endIndex","getLineAreaChartNavUtil","getGapRatio","getStartAndEndAxesOffset","groupCount","children","xStartIndex","xEndIndex","groupsInfo","activeId","focusedItemInfo","hoveredItemInfo","isPointInsideMarquee","getTextDimensions","defaultFontSize","resolvedColors","getItemAriaLabel","plotAreaClipPathId","barSeriesIndex","leafGroups","map","item","_Fragment","Fragment","valueSeries","index","isAssociatedToY2","associatedYAxis","areaOpacity","isAreaRendered","isContrastLineNeeded","lineSegmentCoords","getLineAreaSegments","isBottomSegmentCurved","isHighlighted","size","has","prevCoords","prevValue","newValue","j","_jsxs","slice","_","BarGroup","splitDualY","isDrillEnabled","barGapRatio","getBarGapRatio","group","isSelectionEnabled","AreaSeries","areaColor","isHorizontal","areaColorOpacity","bottomCoords","some","lineSegments","groupWidth","LineSeries","lineColor","colorSchemeVars","dvt","contrastLine","lineWidth","lineStyle","MarkersWithLabel","focusedItemIndex","isFocusVisible","isDataCursorEnabled","dataCursorStyle","isMarkerDisplayed","hoveredItemIndex","isCurrent","datatip","content","zoomAndScroll","plotArea","yMajor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,EADA4D,EAAgBrD,WAGtBmH,iBACE7D,GAAiB8D,WAAa9D,EAAgBvD,cAAgBqE,EAC1Dd,EAAgBtD,gBAChBP,EAENoG,mBACoB,WAAlBpI,GAAgD,aAAlBA,EAEhCgI,eAA6B,OAAb/H,EAChB+F,gBAAiBA,EACjB7F,gBAAiBA,EACjBO,eAAgBA,EAChBwF,iBAAkBA,EAClBnF,MAAOA,MAKf,KAIN,GAGN,IAGN,SAAS2C,EACPrD,GAEA,OACEiD,MAACnE,EAAU,CACTyK,QAAS,KAAO,CAAEC,QAAS,KAC3BC,cAAc,MACdC,SAAU,CACRC,WAAY,CACVC,YAAY,GAEdC,WAAY,CAAE,GAEhB/I,MAAO,CACLgJ,UAAW,CACTC,YAAY,EAEZH,aAAY5J,EAAMc,OAAOD,eAG7BrB,OAAQQ,EAAMR,OACdC,OAAQO,EAAMP,OACdC,YAAaM,EAAMN,YACnBH,MAAO,CACLuK,UAAW,CACTF,YAAY,IAGhBI,SAAS,OAGf"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(['exports', 'preact/jsx-runtime', './utils-8bf50f08', './ReferenceLineArea-450530dd', './MarkersWithLabel-2960e007', './dataStyleUtils-1a157bd8', './useUser-08901aba', './colorUtils-1c8d0c00', './accUtils-7e057eef', './themeContract.css-b6ec3943', './chartUtils-2415ea65', 'preact/compat', './Chart-
|
|
2
|
-
//# sourceMappingURL=LineAreaChart-
|
|
1
|
+
define(['exports', 'preact/jsx-runtime', './utils-8bf50f08', './ReferenceLineArea-450530dd', './MarkersWithLabel-2960e007', './dataStyleUtils-1a157bd8', './useUser-08901aba', './colorUtils-1c8d0c00', './accUtils-7e057eef', './themeContract.css-b6ec3943', './chartUtils-2415ea65', 'preact/compat', './Chart-d9eafc7a'], (function(e,t,i,s,n,r,a,o,d,l,g,c,h){"use strict";const p=c.forwardRef((({width:e,height:d,selectedIds:c=[],hiddenIds:p=[],highlightedIds:I,hideAndShowBehavior:u="none",orientation:m="vertical",yAxis:S,y2Axis:f,series:y,groups:v,isStacked:A=!1,getDataItem:C,selectionMode:T="none",drilling:b="off",type:L="line",overview:D="off",dataLabelEffect:k="outline",...R},E)=>{const{direction:M,forcedColors:w}=a.useUser(),U="active"===w,j=void 0!==R.testId,W="rtl"===M,P="log"===S?.scale,F=R.xAxis?.timeAxisType,z=new Set(p),H=new Set(c),N=new Set(I),O="horizontal"===m,q=o.getColorRamp();let B=A?i.getCumulativeSeries(y.length,v.length,C,z,P):i.getSeriesData(y?.length,v?.length,C,z,P);const V=(e,t)=>A?{...C(e,t),value:B[e][t]}:C(e,t),{hasCenteredSeries:Y,hasUncenteredSeries:G}=y.reduce(((e,t)=>({hasCenteredSeries:e.hasCenteredSeries||"centeredSegmented"===t.lineType||"centeredStepped"===t.lineType,hasUncenteredSeries:e.hasUncenteredSeries||"segmented"===t.lineType||"stepped"===t.lineType})),{hasCenteredSeries:!1,hasUncenteredSeries:!1}),J=i.getMarkers(),K="lineWithArea"===L?.2:1,Q="area"===L||"lineWithArea"===L,X="area"===L,Z=[];return t.jsx(h.Chart,{ref:E,width:e,height:d,selectedIds:H,hiddenIds:p,hideAndShowBehavior:u,orientation:m,yAxis:S,y2Axis:f,series:y,groups:v,selectionMode:T,drilling:b,isStacked:A,getDataItem:C,findNearest:(e,t,s)=>i.findNearestDataPoint(y,v,e,t,V,A,(()=>({offset:0,dataWidth:0})),((e,t)=>t.transform(e)),P,0,z,F,s),getDataItemPos:(e,t,i)=>(s,n)=>{const r="y2"===y[s].associatedYAxis;return g.getLineAreaChartItemPosition(s,n,B,C,v,O,e,r?i:t,F)},getMarkerInfo:(e,t)=>({color:r.getItemColor(e,t,y,C),type:r.getMarkerType(e,t,C)}),renderGridLinesInFront:Q,getNavUtil:(e,t)=>r.getLineAreaChartNavUtil(C,y.length,e,t,A,W,O),getGapRatio:()=>1,getStartAndEndAxesOffset:e=>i.getStartAndEndAxesOffset(Y,G,O,e),isRtl:W,overview:D,defaultOverviewContentRenderer:()=>t.jsx(x,{series:y,groups:v,getDataItem:C,type:L}),...R,children:({getItemAriaLabel:e,groupsInfo:r,xStartIndex:a,xEndIndex:o,xScale:d,yScale:g,y2Scale:c,activeId:h,focusedItemInfo:p,hoveredItemInfo:x,isPointInsideMarquee:u,defaultFontSize:S,getTextDimensions:f,plotAreaClipPathId:v,axisStepWidth:L})=>{const D=r.map((({item:e})=>e));return B=A?i.getCumulativeSeries(y.length,D.length,C,z,P):i.getSeriesData(y?.length,D?.length,C,z,P),t.jsxs(t.Fragment,{children:[B.map(((r,E)=>{if(0===r.length)return;const M=y[E],w="y2"===M.associatedYAxis,z=i.getLineAreaSegments(w?c:g,d,r,a,o,P,D,E,V,F);Z[E]=z[0];const Y="curved"===M.lineType&&A&&B.length>1&&E>0,G=void 0===I||0===I.length||N.has(M.id),$=A&&0!=E?Z.reduce(((e,t,i)=>i>=E?e:t.length>0?i:e),0):void 0;return t.jsxs(t.Fragment,{children:[Q&&t.jsx(s.AreaSeries,{yScale:w?c:g,lineType:M.lineType,color:M.areaColor||q[E%q.length],isHorizontal:O,areaColorOpacity:K,isBottomSegmentCurved:Y,bottomCoords:void 0!==$&&Z[$].some((e=>null!=e))?Z[$]:void 0,lineSegments:z,isLog:P,isHighlighted:G,seriesIndex:E,groupWidth:L,isRtl:W,timeAxisType:F,plotAreaClipPathId:v}),t.jsx(s.LineSeries,{lineType:M.lineType,lineColor:X?l.colorSchemeVars.dvt.contrastLine:M.lineColor,lineWidth:X?A?2.5:1.25:M.lineWidth,lineStyle:M.lineStyle,color:M.lineColor||q[E%q.length],lineSegmentCoords:z,isHorizontal:O,isHighlighted:G,seriesIndex:E,groupWidth:L,isRtl:W,timeAxisType:F,plotAreaClipPathId:v}),!A&&"stepped"!==M.lineType&&"segmented"!==M.lineType&&t.jsx(n.MarkersWithLabel,{yScale:w?c:g,xScale:d,groups:D,series:M,timeAxisType:F,color:M.lineColor||M.areaColor||q[E%q.length],seriesIndex:E,startIndex:a,endIndex:o,markerType:J[E%J.length],orientation:m,isLog:P,activeId:h,getDataItem:C,isPointInsideMarquee:u,selectedIds:H,highlightedIds:void 0!==I?N:void 0,focusedItemIndex:p.seriesIndex!==E||!p.isFocusVisible||R.isDataCursorEnabled&&R.dataCursorStyle?.isMarkerDisplayed?void 0:p.groupIndex,hoveredItemIndex:x?.isCurrent&&x.seriesIndex===E?x.groupIndex:void 0,isSelectionEnabled:"single"===T||"multiple"===T,isDrillEnabled:"on"===b,defaultFontSize:S,dataLabelEffect:k,isHighContrast:U,isTestEnv:j,getTextDimensions:f,getItemAriaLabel:e,isRtl:W})]})})),B.map(((i,s)=>{if(0===i.length)return;const r=y[s],l="y2"===r.associatedYAxis;return A||"segmented"===r.lineType||"stepped"===r.lineType?t.jsx(n.MarkersWithLabel,{yScale:l?c:g,series:y[s],xScale:d,groups:D,timeAxisType:F,color:r.lineColor||r.areaColor||q[s%q.length],seriesIndex:s,isPointInsideMarquee:u,startIndex:a,endIndex:o,markerType:J[s%J.length],orientation:m,isLog:P,activeId:h,getDataItem:V,selectedIds:H,focusedItemIndex:p.seriesIndex===s&&p.isFocusVisible?p.groupIndex:void 0,hoveredItemIndex:x?.isCurrent&&x.seriesIndex===s?x.groupIndex:void 0,isSelectionEnabled:"single"===T||"multiple"===T,isDrillEnabled:"on"===b,defaultFontSize:S,dataLabelEffect:k,isHighContrast:U,isTestEnv:j,getTextDimensions:f,getItemAriaLabel:e,isRtl:W}):void 0}))]})}})}));function x(e){return t.jsx(p,{datatip:()=>({content:""}),zoomAndScroll:"off",overview:"off",plotArea:{yMajorTick:{isRendered:!1}},xAxis:{tickLabel:{autoRotate:!1,isRendered:!!e.xAxis?.timeAxisType}},series:e.series,groups:e.groups,getDataItem:e.getDataItem,yAxis:{tickLabel:{isRendered:!1}},type:e.type})}e.LineAreaChart=p}));
|
|
2
|
+
//# sourceMappingURL=LineAreaChart-47fc17d2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineAreaChart-48efb7f7.js","sources":["../../src/UNSAFE_LineAreaChart/LineAreaChart.tsx"],"sourcesContent":["/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * Licensed under The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\nimport { LineAreaChartProps, LineAreaItem } from './lineAreaChart.types';\nimport {\n findNearestDataPoint,\n getStartAndEndAxesOffset\n} from '#utils/PRIVATE_chartUtils/layoutUtils';\nimport { AreaSeries } from '#PRIVATE_LineAreaComponents/AreaSeries';\nimport { getCumulativeSeries, getMarkers, getSeriesData } from '#utils/PRIVATE_chartUtils/utils';\nimport { MarkersWithLabel } from '#PRIVATE_Chart/MarkersWithLabel';\nimport { getLineAreaChartNavUtil } from '#utils/PRIVATE_chartUtils/navUtils';\nimport { Chart } from '#PRIVATE_Chart';\nimport { Scale, TimeAxisProps, SizeHandle } from '#utils/UNSAFE_visTypes/chart';\nimport { useUser } from '#hooks/UNSAFE_useUser';\nimport { getColorRamp } from '#utils/UNSAFE_visUtils';\nimport { LineSeries } from '#PRIVATE_LineAreaComponents/LineSeries';\nimport { Point } from '#utils/PRIVATE_visSVGUtils';\nimport { getLineAreaSegments } from '#utils/PRIVATE_chartUtils/utils';\nimport { colorSchemeVars } from '@oracle/oraclejet-internal-theme-contract/themeContract.css';\nimport { getItemColor, getMarkerType } from '#utils/PRIVATE_chartUtils/dataStyleUtils';\nimport { getLineAreaChartItemPosition } from '#PRIVATE_LineAreaComponents/utils/chartUtils';\nimport { forwardRef, Ref } from 'preact/compat';\nimport { VNode } from 'preact';\n\nconst LINE_WITH_AREA_OPACITY = 0.2;\nexport type ForwardRefLineAreaChart = <K extends string | number, D extends LineAreaItem<K>>(\n props: LineAreaChartProps<K, D> & {\n ref?: Ref<SizeHandle>;\n }\n) => VNode | null;\n\n/**\n * The LineAreaChart displays information graphically using lines and filled areas, making relationships among the data easier to understand.\n */\nexport const LineAreaChart = forwardRef(\n <K extends string | number, D extends LineAreaItem<K>>(\n {\n width,\n height,\n selectedIds = [],\n hiddenIds = [],\n highlightedIds,\n hideAndShowBehavior = 'none',\n orientation = 'vertical',\n yAxis,\n y2Axis,\n series,\n groups,\n isStacked = false,\n getDataItem,\n selectionMode = 'none',\n drilling = 'off',\n type = 'line',\n overview = 'off',\n dataLabelEffect = 'outline',\n ...props\n }: LineAreaChartProps<K, D>,\n ref: Ref<SizeHandle>\n ) => {\n const { direction, forcedColors } = useUser();\n const isHighContrast = forcedColors === 'active';\n const isTestEnv = props.testId !== undefined;\n const isRtl = direction === 'rtl';\n const isLog = yAxis?.scale === 'log';\n const timeAxisType = (props.xAxis as TimeAxisProps)?.timeAxisType;\n const hiddenSet = new Set(hiddenIds);\n const selectedSet = new Set(selectedIds);\n const highlightedSet = new Set(highlightedIds);\n const isHoriz = orientation === 'horizontal';\n const colors = getColorRamp();\n let renderedSeries = isStacked\n ? getCumulativeSeries(series.length, groups.length, getDataItem, hiddenSet, isLog)\n : getSeriesData(series?.length, groups?.length, getDataItem, hiddenSet, isLog);\n\n const renderedGetDataItem = (seriesIndex: number, groupIndex: number): D | undefined => {\n if (!isStacked) return getDataItem(seriesIndex, groupIndex);\n return {\n ...getDataItem(seriesIndex, groupIndex),\n value: renderedSeries[seriesIndex][groupIndex]\n } as D;\n };\n\n const getGapRatio = () => {\n return 1;\n };\n\n const getNextChartItemFunc = (startIndex: number, endIndex: number) => {\n // TODO: JET-71332\n //@ts-ignore\n return getLineAreaChartNavUtil<D>(\n getDataItem,\n series.length,\n startIndex,\n endIndex,\n isStacked,\n isRtl,\n isHoriz\n );\n };\n\n const getDataItemPos = (xScale: Scale, yScale: Scale, y2Scale: Scale) => {\n return (seriesIndex: number, groupIndex: number) => {\n const isAssociatedToY2 = series[seriesIndex].associatedYAxis === 'y2';\n return getLineAreaChartItemPosition(\n seriesIndex,\n groupIndex,\n renderedSeries,\n getDataItem,\n groups,\n isHoriz,\n xScale,\n isAssociatedToY2 ? y2Scale : yScale,\n timeAxisType\n );\n };\n };\n\n const getMarkerColorAndType = (seriesIndex: number, groupIndex: number) => {\n return {\n color: getItemColor(seriesIndex, groupIndex, series, getDataItem),\n type: getMarkerType(seriesIndex, groupIndex, getDataItem)\n };\n };\n\n const findNearest = (xScale: Scale, yScale: Scale, y2Scale: Scale) => {\n const getSeriesDataInfo = () => {\n return {\n offset: 0,\n dataWidth: 0\n };\n };\n\n const getYCoord = (value: number, yScale: Scale) => {\n return yScale.transform(value);\n };\n\n return findNearestDataPoint<K, D>(\n series,\n groups,\n xScale,\n yScale,\n renderedGetDataItem,\n isStacked,\n getSeriesDataInfo,\n getYCoord,\n isLog,\n 0,\n hiddenSet,\n timeAxisType,\n y2Scale\n );\n };\n const { hasCenteredSeries, hasUncenteredSeries } = series.reduce(\n (acc, s) => {\n return {\n hasCenteredSeries:\n acc.hasCenteredSeries ||\n s.lineType === 'centeredSegmented' ||\n s.lineType === 'centeredStepped',\n hasUncenteredSeries:\n acc.hasUncenteredSeries || s.lineType === 'segmented' || s.lineType === 'stepped'\n };\n },\n { hasCenteredSeries: false, hasUncenteredSeries: false }\n );\n\n const getOffset = (groupCount: number) => {\n return getStartAndEndAxesOffset(hasCenteredSeries, hasUncenteredSeries, isHoriz, groupCount);\n };\n\n const markers = getMarkers();\n const areaOpacity = type === 'lineWithArea' ? LINE_WITH_AREA_OPACITY : 1;\n const isAreaRendered = type === 'area' || type === 'lineWithArea';\n const isContrastLineNeeded = type === 'area';\n const allLineSegmentCoords: Point[][] = [];\n\n return (\n <Chart\n ref={ref}\n width={width}\n height={height}\n selectedIds={selectedSet}\n hiddenIds={hiddenIds}\n hideAndShowBehavior={hideAndShowBehavior}\n orientation={orientation}\n yAxis={yAxis}\n y2Axis={y2Axis}\n series={series}\n groups={groups}\n selectionMode={selectionMode}\n drilling={drilling}\n isStacked={isStacked}\n getDataItem={getDataItem}\n findNearest={findNearest}\n getDataItemPos={getDataItemPos}\n getMarkerInfo={getMarkerColorAndType}\n renderGridLinesInFront={isAreaRendered}\n getNavUtil={getNextChartItemFunc}\n getGapRatio={getGapRatio}\n getStartAndEndAxesOffset={getOffset}\n isRtl={isRtl}\n overview={overview}\n defaultOverviewContentRenderer={() => {\n return (\n <OverviewLineAreaChart\n series={series}\n groups={groups}\n getDataItem={getDataItem}\n type={type}\n />\n );\n }}\n {...props}>\n {({\n getItemAriaLabel,\n groupsInfo,\n xStartIndex,\n xEndIndex,\n xScale,\n yScale,\n y2Scale,\n activeId,\n focusedItemInfo,\n hoveredItemInfo,\n isPointInsideMarquee,\n defaultFontSize,\n getTextDimensions,\n plotAreaClipPathId,\n axisStepWidth\n }) => {\n const leafGroups = groupsInfo.map(({ item }) => item);\n renderedSeries = isStacked\n ? getCumulativeSeries(series.length, leafGroups.length, getDataItem, hiddenSet, isLog)\n : getSeriesData(series?.length, leafGroups?.length, getDataItem, hiddenSet, isLog);\n return (\n <>\n {renderedSeries.map((lineAreaSeries, index) => {\n if (lineAreaSeries.length === 0) {\n /* TODO: need a better way to handle when a series is hidden. */\n return;\n }\n const seriesItem = series[index];\n const isAssociatedToY2 = seriesItem.associatedYAxis === 'y2';\n const lineSegmentCoords: Point[][] = getLineAreaSegments<K, D>(\n isAssociatedToY2 ? y2Scale : yScale,\n xScale,\n lineAreaSeries,\n xStartIndex,\n xEndIndex,\n isLog,\n leafGroups,\n index,\n renderedGetDataItem,\n timeAxisType\n );\n allLineSegmentCoords[index] = lineSegmentCoords[0];\n const isBottomSegmentCurved =\n seriesItem.lineType === 'curved' &&\n isStacked &&\n renderedSeries.length > 1 &&\n index > 0;\n\n const isHighlighted =\n highlightedIds === undefined ||\n highlightedIds.length === 0 ||\n highlightedSet.has(seriesItem.id);\n\n const prevCoords =\n isStacked && index != 0\n ? allLineSegmentCoords.reduce((prevValue, newValue, j) => {\n // find the index i such that i < index, and series i has at least\n // one or more data item unhidden. Only such series will can be\n // used as bottomCoord for current series. Otherwise we have to use\n // baseline coord\n if (j >= index) {\n return prevValue;\n }\n if (newValue.length > 0) {\n return j;\n }\n return prevValue;\n }, 0)\n : undefined;\n\n return (\n <>\n {isAreaRendered && (\n <AreaSeries\n yScale={isAssociatedToY2 ? y2Scale : yScale}\n lineType={seriesItem.lineType}\n color={seriesItem.areaColor || colors[index % colors.length]}\n isHorizontal={isHoriz}\n areaColorOpacity={areaOpacity}\n isBottomSegmentCurved={isBottomSegmentCurved}\n bottomCoords={\n prevCoords !== undefined &&\n allLineSegmentCoords[prevCoords].some((value) => value != null)\n ? allLineSegmentCoords[prevCoords]\n : undefined\n }\n lineSegments={lineSegmentCoords}\n isLog={isLog}\n isHighlighted={isHighlighted}\n seriesIndex={index}\n groupWidth={axisStepWidth}\n isRtl={isRtl}\n timeAxisType={timeAxisType}\n plotAreaClipPathId={plotAreaClipPathId}\n />\n )}\n <LineSeries\n lineType={seriesItem.lineType}\n /* TODO: confirm with UX if this is contrastLine (changes depending on dark/light mode) or always white. \n It's always white in legacy.*/\n lineColor={\n isContrastLineNeeded\n ? colorSchemeVars.dvt.contrastLine\n : seriesItem.lineColor\n }\n /* The area generated in legacy are bit apart and not touching when stacked. Preact areas are a bit closer than legacy when curved. \n Increased the contrast linewidth (to 2.5 from legacy 1.25) to give legacy visual treatment.\n TODO: investivage why legacy areas are not touching. maybe we want to do the same in preact svg utils that\n generates this curve.\n */\n lineWidth={\n isContrastLineNeeded ? (isStacked ? 2.5 : 1.25) : seriesItem.lineWidth\n }\n lineStyle={seriesItem.lineStyle}\n color={seriesItem.lineColor || colors[index % colors.length]}\n lineSegmentCoords={lineSegmentCoords}\n isHorizontal={isHoriz}\n isHighlighted={isHighlighted}\n seriesIndex={index}\n groupWidth={axisStepWidth}\n isRtl={isRtl}\n timeAxisType={timeAxisType}\n plotAreaClipPathId={plotAreaClipPathId}\n />\n {\n /* For non stacked charts, markers should render in the order of series. Some markers might get hidden behind area but this preserves the legacy behavior.\n JET-75357: Segmented and stepped lines may stack markers/lines incorrectly by series order, so excluded from non-stacked charts.\n */\n !isStacked &&\n seriesItem.lineType !== 'stepped' &&\n seriesItem.lineType !== 'segmented' && (\n <MarkersWithLabel\n yScale={isAssociatedToY2 ? y2Scale : yScale}\n xScale={xScale}\n groups={leafGroups}\n series={seriesItem}\n timeAxisType={timeAxisType}\n color={\n seriesItem.lineColor ||\n seriesItem.areaColor ||\n colors[\n index % colors.length\n ] /* TODO : make this use getItemColor function from dataStyleUtils. */\n }\n seriesIndex={index}\n startIndex={xStartIndex}\n endIndex={xEndIndex}\n markerType={markers[index % markers.length]}\n orientation={orientation}\n isLog={isLog}\n activeId={activeId}\n getDataItem={getDataItem}\n isPointInsideMarquee={isPointInsideMarquee}\n selectedIds={selectedSet}\n highlightedIds={\n highlightedIds !== undefined ? highlightedSet : undefined\n }\n focusedItemIndex={\n focusedItemInfo.seriesIndex === index &&\n focusedItemInfo.isFocusVisible &&\n !(\n props.isDataCursorEnabled &&\n props.dataCursorStyle?.isMarkerDisplayed\n )\n ? focusedItemInfo.groupIndex\n : undefined\n }\n hoveredItemIndex={\n hoveredItemInfo?.isCurrent && hoveredItemInfo.seriesIndex === index\n ? hoveredItemInfo.groupIndex\n : undefined\n }\n isSelectionEnabled={\n selectionMode === 'single' || selectionMode === 'multiple'\n }\n isDrillEnabled={drilling === 'on'}\n defaultFontSize={defaultFontSize}\n dataLabelEffect={dataLabelEffect}\n isHighContrast={isHighContrast}\n isTestEnv={isTestEnv}\n getTextDimensions={getTextDimensions}\n getItemAriaLabel={getItemAriaLabel}\n isRtl={isRtl}\n />\n )\n }\n </>\n );\n })}\n {renderedSeries.map((lineAreaSeries, index) => {\n if (lineAreaSeries.length === 0) {\n /* TODO: need a better way to handle when a series is hidden.*/\n return;\n }\n const seriesItem = series[index];\n const isAssociatedToY2 = seriesItem.associatedYAxis === 'y2';\n return isStacked ||\n seriesItem.lineType === 'segmented' ||\n seriesItem.lineType === 'stepped' ? (\n <MarkersWithLabel\n yScale={isAssociatedToY2 ? y2Scale : yScale}\n series={series[index]}\n xScale={xScale}\n groups={leafGroups}\n timeAxisType={timeAxisType}\n color={\n seriesItem.lineColor || seriesItem.areaColor || colors[index % colors.length]\n }\n seriesIndex={index}\n isPointInsideMarquee={isPointInsideMarquee}\n startIndex={xStartIndex}\n endIndex={xEndIndex}\n markerType={markers[index % markers.length]}\n orientation={orientation}\n isLog={isLog}\n activeId={activeId}\n getDataItem={renderedGetDataItem}\n selectedIds={selectedSet}\n focusedItemIndex={\n focusedItemInfo.seriesIndex === index && focusedItemInfo.isFocusVisible\n ? focusedItemInfo.groupIndex\n : undefined\n }\n hoveredItemIndex={\n hoveredItemInfo?.isCurrent && hoveredItemInfo.seriesIndex === index\n ? hoveredItemInfo.groupIndex\n : undefined\n }\n isSelectionEnabled={selectionMode === 'single' || selectionMode === 'multiple'}\n isDrillEnabled={drilling === 'on'}\n defaultFontSize={defaultFontSize}\n dataLabelEffect={dataLabelEffect}\n isHighContrast={isHighContrast}\n isTestEnv={isTestEnv}\n getTextDimensions={getTextDimensions}\n getItemAriaLabel={getItemAriaLabel}\n isRtl={isRtl}\n />\n ) : undefined;\n })}\n </>\n );\n }}\n </Chart>\n );\n }\n) as ForwardRefLineAreaChart;\n\nfunction OverviewLineAreaChart<K extends string | number, D extends LineAreaItem<K>>(\n props: LineAreaChartProps<K, D>\n) {\n return (\n <LineAreaChart\n datatip={() => ({ content: '' })}\n zoomAndScroll=\"off\"\n overview=\"off\"\n plotArea={{\n yMajorTick: {\n isRendered: false\n }\n }}\n xAxis={{\n tickLabel: {\n autoRotate: false,\n // @ts-ignore\n isRendered: props.xAxis?.timeAxisType ? true : false\n }\n }}\n series={props.series}\n groups={props.groups}\n getDataItem={props.getDataItem}\n yAxis={{\n tickLabel: {\n isRendered: false\n }\n }}\n type={props.type}\n />\n );\n}\n"],"names":["LineAreaChart","forwardRef","width","height","selectedIds","hiddenIds","highlightedIds","hideAndShowBehavior","orientation","yAxis","y2Axis","series","groups","isStacked","getDataItem","selectionMode","drilling","type","overview","dataLabelEffect","props","ref","direction","forcedColors","useUser","isHighContrast","isTestEnv","undefined","testId","isRtl","isLog","scale","timeAxisType","xAxis","hiddenSet","Set","selectedSet","highlightedSet","isHoriz","colors","getColorRamp","renderedSeries","getCumulativeSeries","length","getSeriesData","renderedGetDataItem","seriesIndex","groupIndex","value","hasCenteredSeries","hasUncenteredSeries","reduce","acc","s","lineType","markers","getMarkers","areaOpacity","isAreaRendered","isContrastLineNeeded","allLineSegmentCoords","_jsx","Chart","findNearest","xScale","yScale","y2Scale","findNearestDataPoint","offset","dataWidth","transform","getDataItemPos","isAssociatedToY2","associatedYAxis","getLineAreaChartItemPosition","getMarkerInfo","color","getItemColor","getMarkerType","renderGridLinesInFront","getNavUtil","startIndex","endIndex","getLineAreaChartNavUtil","getGapRatio","getStartAndEndAxesOffset","groupCount","defaultOverviewContentRenderer","OverviewLineAreaChart","children","getItemAriaLabel","groupsInfo","xStartIndex","xEndIndex","activeId","focusedItemInfo","hoveredItemInfo","isPointInsideMarquee","defaultFontSize","getTextDimensions","plotAreaClipPathId","axisStepWidth","leafGroups","map","item","_jsxs","jsxs","_Fragment","Fragment","lineAreaSeries","index","seriesItem","lineSegmentCoords","getLineAreaSegments","isBottomSegmentCurved","isHighlighted","has","id","prevCoords","prevValue","newValue","j","AreaSeries","areaColor","isHorizontal","areaColorOpacity","bottomCoords","some","lineSegments","groupWidth","LineSeries","lineColor","colorSchemeVars","dvt","contrastLine","lineWidth","lineStyle","MarkersWithLabel","markerType","focusedItemIndex","isFocusVisible","isDataCursorEnabled","dataCursorStyle","isMarkerDisplayed","hoveredItemIndex","isCurrent","isSelectionEnabled","isDrillEnabled","jsx","datatip","content","zoomAndScroll","plotArea","yMajorTick","isRendered","tickLabel","autoRotate"],"mappings":"mWA6BA,MAUaA,EAAgBC,EAAUA,YACrC,EAEIC,QACAC,SACAC,cAAc,GACdC,YAAY,GACZC,iBACAC,sBAAsB,OACtBC,cAAc,WACdC,QACAC,SACAC,SACAC,SACAC,aAAY,EACZC,cACAC,gBAAgB,OAChBC,WAAW,MACXC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ACTD,YAAY,IAGhBzI,KAAMG,EAAMH,MAGlB"}
|
|
1
|
+
{"version":3,"file":"LineAreaChart-47fc17d2.js","sources":["../../src/UNSAFE_LineAreaChart/LineAreaChart.tsx"],"sourcesContent":["/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * Licensed under The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\nimport { LineAreaChartProps, LineAreaItem } from './lineAreaChart.types';\nimport {\n findNearestDataPoint,\n getStartAndEndAxesOffset\n} from '#utils/PRIVATE_chartUtils/layoutUtils';\nimport { AreaSeries } from '#PRIVATE_LineAreaComponents/AreaSeries';\nimport { getCumulativeSeries, getMarkers, getSeriesData } from '#utils/PRIVATE_chartUtils/utils';\nimport { MarkersWithLabel } from '#PRIVATE_Chart/MarkersWithLabel';\nimport { getLineAreaChartNavUtil } from '#utils/PRIVATE_chartUtils/navUtils';\nimport { Chart } from '#PRIVATE_Chart';\nimport { Scale, TimeAxisProps, SizeHandle } from '#utils/UNSAFE_visTypes/chart';\nimport { useUser } from '#hooks/UNSAFE_useUser';\nimport { getColorRamp } from '#utils/UNSAFE_visUtils';\nimport { LineSeries } from '#PRIVATE_LineAreaComponents/LineSeries';\nimport { Point } from '#utils/PRIVATE_visSVGUtils';\nimport { getLineAreaSegments } from '#utils/PRIVATE_chartUtils/utils';\nimport { colorSchemeVars } from '@oracle/oraclejet-internal-theme-contract/themeContract.css';\nimport { getItemColor, getMarkerType } from '#utils/PRIVATE_chartUtils/dataStyleUtils';\nimport { getLineAreaChartItemPosition } from '#PRIVATE_LineAreaComponents/utils/chartUtils';\nimport { forwardRef, Ref } from 'preact/compat';\nimport { VNode } from 'preact';\n\nconst LINE_WITH_AREA_OPACITY = 0.2;\nexport type ForwardRefLineAreaChart = <K extends string | number, D extends LineAreaItem<K>>(\n props: LineAreaChartProps<K, D> & {\n ref?: Ref<SizeHandle>;\n }\n) => VNode | null;\n\n/**\n * The LineAreaChart displays information graphically using lines and filled areas, making relationships among the data easier to understand.\n */\nexport const LineAreaChart = forwardRef(\n <K extends string | number, D extends LineAreaItem<K>>(\n {\n width,\n height,\n selectedIds = [],\n hiddenIds = [],\n highlightedIds,\n hideAndShowBehavior = 'none',\n orientation = 'vertical',\n yAxis,\n y2Axis,\n series,\n groups,\n isStacked = false,\n getDataItem,\n selectionMode = 'none',\n drilling = 'off',\n type = 'line',\n overview = 'off',\n dataLabelEffect = 'outline',\n ...props\n }: LineAreaChartProps<K, D>,\n ref: Ref<SizeHandle>\n ) => {\n const { direction, forcedColors } = useUser();\n const isHighContrast = forcedColors === 'active';\n const isTestEnv = props.testId !== undefined;\n const isRtl = direction === 'rtl';\n const isLog = yAxis?.scale === 'log';\n const timeAxisType = (props.xAxis as TimeAxisProps)?.timeAxisType;\n const hiddenSet = new Set(hiddenIds);\n const selectedSet = new Set(selectedIds);\n const highlightedSet = new Set(highlightedIds);\n const isHoriz = orientation === 'horizontal';\n const colors = getColorRamp();\n let renderedSeries = isStacked\n ? getCumulativeSeries(series.length, groups.length, getDataItem, hiddenSet, isLog)\n : getSeriesData(series?.length, groups?.length, getDataItem, hiddenSet, isLog);\n\n const renderedGetDataItem = (seriesIndex: number, groupIndex: number): D | undefined => {\n if (!isStacked) return getDataItem(seriesIndex, groupIndex);\n return {\n ...getDataItem(seriesIndex, groupIndex),\n value: renderedSeries[seriesIndex][groupIndex]\n } as D;\n };\n\n const getGapRatio = () => {\n return 1;\n };\n\n const getNextChartItemFunc = (startIndex: number, endIndex: number) => {\n // TODO: JET-71332\n //@ts-ignore\n return getLineAreaChartNavUtil<D>(\n getDataItem,\n series.length,\n startIndex,\n endIndex,\n isStacked,\n isRtl,\n isHoriz\n );\n };\n\n const getDataItemPos = (xScale: Scale, yScale: Scale, y2Scale: Scale) => {\n return (seriesIndex: number, groupIndex: number) => {\n const isAssociatedToY2 = series[seriesIndex].associatedYAxis === 'y2';\n return getLineAreaChartItemPosition(\n seriesIndex,\n groupIndex,\n renderedSeries,\n getDataItem,\n groups,\n isHoriz,\n xScale,\n isAssociatedToY2 ? y2Scale : yScale,\n timeAxisType\n );\n };\n };\n\n const getMarkerColorAndType = (seriesIndex: number, groupIndex: number) => {\n return {\n color: getItemColor(seriesIndex, groupIndex, series, getDataItem),\n type: getMarkerType(seriesIndex, groupIndex, getDataItem)\n };\n };\n\n const findNearest = (xScale: Scale, yScale: Scale, y2Scale: Scale) => {\n const getSeriesDataInfo = () => {\n return {\n offset: 0,\n dataWidth: 0\n };\n };\n\n const getYCoord = (value: number, yScale: Scale) => {\n return yScale.transform(value);\n };\n\n return findNearestDataPoint<K, D>(\n series,\n groups,\n xScale,\n yScale,\n renderedGetDataItem,\n isStacked,\n getSeriesDataInfo,\n getYCoord,\n isLog,\n 0,\n hiddenSet,\n timeAxisType,\n y2Scale\n );\n };\n const { hasCenteredSeries, hasUncenteredSeries } = series.reduce(\n (acc, s) => {\n return {\n hasCenteredSeries:\n acc.hasCenteredSeries ||\n s.lineType === 'centeredSegmented' ||\n s.lineType === 'centeredStepped',\n hasUncenteredSeries:\n acc.hasUncenteredSeries || s.lineType === 'segmented' || s.lineType === 'stepped'\n };\n },\n { hasCenteredSeries: false, hasUncenteredSeries: false }\n );\n\n const getOffset = (groupCount: number) => {\n return getStartAndEndAxesOffset(hasCenteredSeries, hasUncenteredSeries, isHoriz, groupCount);\n };\n\n const markers = getMarkers();\n const areaOpacity = type === 'lineWithArea' ? LINE_WITH_AREA_OPACITY : 1;\n const isAreaRendered = type === 'area' || type === 'lineWithArea';\n const isContrastLineNeeded = type === 'area';\n const allLineSegmentCoords: Point[][] = [];\n\n return (\n <Chart\n ref={ref}\n width={width}\n height={height}\n selectedIds={selectedSet}\n hiddenIds={hiddenIds}\n hideAndShowBehavior={hideAndShowBehavior}\n orientation={orientation}\n yAxis={yAxis}\n y2Axis={y2Axis}\n series={series}\n groups={groups}\n selectionMode={selectionMode}\n drilling={drilling}\n isStacked={isStacked}\n getDataItem={getDataItem}\n findNearest={findNearest}\n getDataItemPos={getDataItemPos}\n getMarkerInfo={getMarkerColorAndType}\n renderGridLinesInFront={isAreaRendered}\n getNavUtil={getNextChartItemFunc}\n getGapRatio={getGapRatio}\n getStartAndEndAxesOffset={getOffset}\n isRtl={isRtl}\n overview={overview}\n defaultOverviewContentRenderer={() => {\n return (\n <OverviewLineAreaChart\n series={series}\n groups={groups}\n getDataItem={getDataItem}\n type={type}\n />\n );\n }}\n {...props}>\n {({\n getItemAriaLabel,\n groupsInfo,\n xStartIndex,\n xEndIndex,\n xScale,\n yScale,\n y2Scale,\n activeId,\n focusedItemInfo,\n hoveredItemInfo,\n isPointInsideMarquee,\n defaultFontSize,\n getTextDimensions,\n plotAreaClipPathId,\n axisStepWidth\n }) => {\n const leafGroups = groupsInfo.map(({ item }) => item);\n renderedSeries = isStacked\n ? getCumulativeSeries(series.length, leafGroups.length, getDataItem, hiddenSet, isLog)\n : getSeriesData(series?.length, leafGroups?.length, getDataItem, hiddenSet, isLog);\n return (\n <>\n {renderedSeries.map((lineAreaSeries, index) => {\n if (lineAreaSeries.length === 0) {\n /* TODO: need a better way to handle when a series is hidden. */\n return;\n }\n const seriesItem = series[index];\n const isAssociatedToY2 = seriesItem.associatedYAxis === 'y2';\n const lineSegmentCoords: Point[][] = getLineAreaSegments<K, D>(\n isAssociatedToY2 ? y2Scale : yScale,\n xScale,\n lineAreaSeries,\n xStartIndex,\n xEndIndex,\n isLog,\n leafGroups,\n index,\n renderedGetDataItem,\n timeAxisType\n );\n allLineSegmentCoords[index] = lineSegmentCoords[0];\n const isBottomSegmentCurved =\n seriesItem.lineType === 'curved' &&\n isStacked &&\n renderedSeries.length > 1 &&\n index > 0;\n\n const isHighlighted =\n highlightedIds === undefined ||\n highlightedIds.length === 0 ||\n highlightedSet.has(seriesItem.id);\n\n const prevCoords =\n isStacked && index != 0\n ? allLineSegmentCoords.reduce((prevValue, newValue, j) => {\n // find the index i such that i < index, and series i has at least\n // one or more data item unhidden. Only such series will can be\n // used as bottomCoord for current series. Otherwise we have to use\n // baseline coord\n if (j >= index) {\n return prevValue;\n }\n if (newValue.length > 0) {\n return j;\n }\n return prevValue;\n }, 0)\n : undefined;\n\n return (\n <>\n {isAreaRendered && (\n <AreaSeries\n yScale={isAssociatedToY2 ? y2Scale : yScale}\n lineType={seriesItem.lineType}\n color={seriesItem.areaColor || colors[index % colors.length]}\n isHorizontal={isHoriz}\n areaColorOpacity={areaOpacity}\n isBottomSegmentCurved={isBottomSegmentCurved}\n bottomCoords={\n prevCoords !== undefined &&\n allLineSegmentCoords[prevCoords].some((value) => value != null)\n ? allLineSegmentCoords[prevCoords]\n : undefined\n }\n lineSegments={lineSegmentCoords}\n isLog={isLog}\n isHighlighted={isHighlighted}\n seriesIndex={index}\n groupWidth={axisStepWidth}\n isRtl={isRtl}\n timeAxisType={timeAxisType}\n plotAreaClipPathId={plotAreaClipPathId}\n />\n )}\n <LineSeries\n lineType={seriesItem.lineType}\n /* TODO: confirm with UX if this is contrastLine (changes depending on dark/light mode) or always white. \n It's always white in legacy.*/\n lineColor={\n isContrastLineNeeded\n ? colorSchemeVars.dvt.contrastLine\n : seriesItem.lineColor\n }\n /* The area generated in legacy are bit apart and not touching when stacked. Preact areas are a bit closer than legacy when curved. \n Increased the contrast linewidth (to 2.5 from legacy 1.25) to give legacy visual treatment.\n TODO: investivage why legacy areas are not touching. maybe we want to do the same in preact svg utils that\n generates this curve.\n */\n lineWidth={\n isContrastLineNeeded ? (isStacked ? 2.5 : 1.25) : seriesItem.lineWidth\n }\n lineStyle={seriesItem.lineStyle}\n color={seriesItem.lineColor || colors[index % colors.length]}\n lineSegmentCoords={lineSegmentCoords}\n isHorizontal={isHoriz}\n isHighlighted={isHighlighted}\n seriesIndex={index}\n groupWidth={axisStepWidth}\n isRtl={isRtl}\n timeAxisType={timeAxisType}\n plotAreaClipPathId={plotAreaClipPathId}\n />\n {\n /* For non stacked charts, markers should render in the order of series. Some markers might get hidden behind area but this preserves the legacy behavior.\n JET-75357: Segmented and stepped lines may stack markers/lines incorrectly by series order, so excluded from non-stacked charts.\n */\n !isStacked &&\n seriesItem.lineType !== 'stepped' &&\n seriesItem.lineType !== 'segmented' && (\n <MarkersWithLabel\n yScale={isAssociatedToY2 ? y2Scale : yScale}\n xScale={xScale}\n groups={leafGroups}\n series={seriesItem}\n timeAxisType={timeAxisType}\n color={\n seriesItem.lineColor ||\n seriesItem.areaColor ||\n colors[\n index % colors.length\n ] /* TODO : make this use getItemColor function from dataStyleUtils. */\n }\n seriesIndex={index}\n startIndex={xStartIndex}\n endIndex={xEndIndex}\n markerType={markers[index % markers.length]}\n orientation={orientation}\n isLog={isLog}\n activeId={activeId}\n getDataItem={getDataItem}\n isPointInsideMarquee={isPointInsideMarquee}\n selectedIds={selectedSet}\n highlightedIds={\n highlightedIds !== undefined ? highlightedSet : undefined\n }\n focusedItemIndex={\n focusedItemInfo.seriesIndex === index &&\n focusedItemInfo.isFocusVisible &&\n !(\n props.isDataCursorEnabled &&\n props.dataCursorStyle?.isMarkerDisplayed\n )\n ? focusedItemInfo.groupIndex\n : undefined\n }\n hoveredItemIndex={\n hoveredItemInfo?.isCurrent && hoveredItemInfo.seriesIndex === index\n ? hoveredItemInfo.groupIndex\n : undefined\n }\n isSelectionEnabled={\n selectionMode === 'single' || selectionMode === 'multiple'\n }\n isDrillEnabled={drilling === 'on'}\n defaultFontSize={defaultFontSize}\n dataLabelEffect={dataLabelEffect}\n isHighContrast={isHighContrast}\n isTestEnv={isTestEnv}\n getTextDimensions={getTextDimensions}\n getItemAriaLabel={getItemAriaLabel}\n isRtl={isRtl}\n />\n )\n }\n </>\n );\n })}\n {renderedSeries.map((lineAreaSeries, index) => {\n if (lineAreaSeries.length === 0) {\n /* TODO: need a better way to handle when a series is hidden.*/\n return;\n }\n const seriesItem = series[index];\n const isAssociatedToY2 = seriesItem.associatedYAxis === 'y2';\n return isStacked ||\n seriesItem.lineType === 'segmented' ||\n seriesItem.lineType === 'stepped' ? (\n <MarkersWithLabel\n yScale={isAssociatedToY2 ? y2Scale : yScale}\n series={series[index]}\n xScale={xScale}\n groups={leafGroups}\n timeAxisType={timeAxisType}\n color={\n seriesItem.lineColor || seriesItem.areaColor || colors[index % colors.length]\n }\n seriesIndex={index}\n isPointInsideMarquee={isPointInsideMarquee}\n startIndex={xStartIndex}\n endIndex={xEndIndex}\n markerType={markers[index % markers.length]}\n orientation={orientation}\n isLog={isLog}\n activeId={activeId}\n getDataItem={renderedGetDataItem}\n selectedIds={selectedSet}\n focusedItemIndex={\n focusedItemInfo.seriesIndex === index && focusedItemInfo.isFocusVisible\n ? focusedItemInfo.groupIndex\n : undefined\n }\n hoveredItemIndex={\n hoveredItemInfo?.isCurrent && hoveredItemInfo.seriesIndex === index\n ? hoveredItemInfo.groupIndex\n : undefined\n }\n isSelectionEnabled={selectionMode === 'single' || selectionMode === 'multiple'}\n isDrillEnabled={drilling === 'on'}\n defaultFontSize={defaultFontSize}\n dataLabelEffect={dataLabelEffect}\n isHighContrast={isHighContrast}\n isTestEnv={isTestEnv}\n getTextDimensions={getTextDimensions}\n getItemAriaLabel={getItemAriaLabel}\n isRtl={isRtl}\n />\n ) : undefined;\n })}\n </>\n );\n }}\n </Chart>\n );\n }\n) as ForwardRefLineAreaChart;\n\nfunction OverviewLineAreaChart<K extends string | number, D extends LineAreaItem<K>>(\n props: LineAreaChartProps<K, D>\n) {\n return (\n <LineAreaChart\n datatip={() => ({ content: '' })}\n zoomAndScroll=\"off\"\n overview=\"off\"\n plotArea={{\n yMajorTick: {\n isRendered: false\n }\n }}\n xAxis={{\n tickLabel: {\n autoRotate: false,\n // @ts-ignore\n isRendered: props.xAxis?.timeAxisType ? true : false\n }\n }}\n series={props.series}\n groups={props.groups}\n getDataItem={props.getDataItem}\n yAxis={{\n tickLabel: {\n isRendered: false\n }\n }}\n type={props.type}\n />\n );\n}\n"],"names":["LineAreaChart","forwardRef","width","height","selectedIds","hiddenIds","highlightedIds","hideAndShowBehavior","orientation","yAxis","y2Axis","series","groups","isStacked","getDataItem","selectionMode","drilling","type","overview","dataLabelEffect","props","ref","direction","forcedColors","useUser","isHighContrast","isTestEnv","undefined","testId","isRtl","isLog","scale","timeAxisType","xAxis","hiddenSet","Set","selectedSet","highlightedSet","isHoriz","colors","getColorRamp","renderedSeries","getCumulativeSeries","length","getSeriesData","renderedGetDataItem","seriesIndex","groupIndex","value","hasCenteredSeries","hasUncenteredSeries","reduce","acc","s","lineType","markers","getMarkers","areaOpacity","isAreaRendered","isContrastLineNeeded","allLineSegmentCoords","_jsx","Chart","findNearest","xScale","yScale","y2Scale","findNearestDataPoint","offset","dataWidth","transform","getDataItemPos","isAssociatedToY2","associatedYAxis","getLineAreaChartItemPosition","getMarkerInfo","color","getItemColor","getMarkerType","renderGridLinesInFront","getNavUtil","startIndex","endIndex","getLineAreaChartNavUtil","getGapRatio","getStartAndEndAxesOffset","groupCount","defaultOverviewContentRenderer","OverviewLineAreaChart","children","getItemAriaLabel","groupsInfo","xStartIndex","xEndIndex","activeId","focusedItemInfo","hoveredItemInfo","isPointInsideMarquee","defaultFontSize","getTextDimensions","plotAreaClipPathId","axisStepWidth","leafGroups","map","item","_jsxs","jsxs","_Fragment","Fragment","lineAreaSeries","index","seriesItem","lineSegmentCoords","getLineAreaSegments","isBottomSegmentCurved","isHighlighted","has","id","prevCoords","prevValue","newValue","j","AreaSeries","areaColor","isHorizontal","areaColorOpacity","bottomCoords","some","lineSegments","groupWidth","LineSeries","lineColor","colorSchemeVars","dvt","contrastLine","lineWidth","lineStyle","MarkersWithLabel","markerType","focusedItemIndex","isFocusVisible","isDataCursorEnabled","dataCursorStyle","isMarkerDisplayed","hoveredItemIndex","isCurrent","isSelectionEnabled","isDrillEnabled","jsx","datatip","content","zoomAndScroll","plotArea","yMajorTick","isRendered","tickLabel","autoRotate"],"mappings":"mWA6BA,MAUaA,EAAgBC,EAAUA,YACrC,EAEIC,QACAC,SACAC,cAAc,GACdC,YAAY,GACZC,iBACAC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D,eAG7BrB,OAAQS,EAAMT,OACdC,OAAQQ,EAAMR,OACdE,YAAaM,EAAMN,YACnBL,MAAO,CACLkJ,UAAW,CACTD,YAAY,IAGhBzI,KAAMG,EAAMH,MAGlB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
define(['exports', 'preact/jsx-runtime', 'preact/compat', 'preact/hooks', './LayerHost-0b288129', './StyledCheckbox-368fed68', 'css!./SelectorStyles.styles.css', './CollectionInteractionContext-0b4ed98b', 'css!./DragAndDropStyles.styles.css', 'css!./ReorderableItemStyles.styles.css', './ReorderableContext-6d10a1b7', './HiddenAccessible-037ef42d', './List-daac1169', './keys-4755c121', './useReorderableItem-7b4b2c3d', './classNames-08d99695', './UNSAFE_ListView/themes/ListViewStyles.css', './useNavigation-4d87e7e6', './mergeProps-bcfa6a92', './collectionUtils-77dc5fa1', './Menu-1b8fefc5', './MenuItem-85e4ffdc', 'preact', './logger-0f873e29', 'css!./TooltipContentStyles.styles.css', 'module', './hooks/UNSAFE_useTooltip/themes/redwood/TooltipContentVariants.css', './tooltipUtils-2bb62284', 'css!./IconStyle.styles.css', './SelectMenuGroupContext-67f24a8f', './UNSAFE_Menu/themes/MenuItemStyles.css', './UNSAFE_Separator/themes/SeparatorStyles.css', 'css!./MenuSeparatorStyles.styles.css', 'module', './UNSAFE_Menu/themes/redwood/MenuSeparatorVariants.css', './menuUtils-8e42385f', 'css!./MenuStyles.styles.css', './useItemAction-3616efde', './useContextMenuGesture-750ef2c6', './LoadMoreCollection-895f1ed5'], (function(e,r,t,o,s,n,i,a,l,c,d,u,m,f,y,I,g,C,S,p,x,R,b,h,M,v,T,E,L,P,O,k,K,_,D,j,w,A,F,N){"use strict";const U=t.memo((function({children:e,dragKey:t,setDragKey:s,onReorder:n,rootRef:i,itemKey:a}){const l=o.useRef(null),c={itemOverlayFront:g.styles.reorderableItemOverlayFront,itemOverlayRear:g.styles.reorderableItemOverlayRear,itemDragger:g.styles.reorderableItemDragger},d=o.useCallback((e=>{e.dataTransfer?.setData("text/listview-items-key",JSON.stringify(a))}),[a]),{rootProps:u,isDragged:m,overlayZoneBeforeProps:S,overlayZoneAfterProps:p}=y.useReorderableItem({isDisabled:!n,dragKey:t,setDragKey:s,onReorder:n,rootRef:i,ref:l,getItem:()=>l?.current?.closest(C.LIST_ITEM_SELECTOR),setTransferData:d,itemStyles:c,itemSelector:C.LIST_ITEM_SELECTOR,isVertical:!0}),x=I.classNames([u?.class,g.styles.reorderableItemDnd]);return r.jsxs("div",{...u,class:x,children:[e,!m&&f.isKeyDefined(t)&&r.jsxs(r.Fragment,{children:[r.jsx("div",{...S}),r.jsx("div",{...p})]})]})}),((e,r)=>!(!e||!r)&&(e.children===r.children&&e.dragKey===r.dragKey)));function V({contextMenuConfig:e,testId:t,contextMenuContext:o,...s}){const n=e.accessibleLabel;let i;if(s.isOpen){if(i=e.itemsRenderer(o),j.isMenuChildrenFalsy(i))return null}else i=null;return r.jsx(x.Menu,{...s,...n&&{"aria-label":n},testId:t,children:i})}const B={mouse:{initialFocus:"menu",placement:"bottom-start",offsetValue:0},keyboard:{initialFocus:"firstItem",placement:"bottom-start",offsetValue:0},touch:{initialFocus:"firstItem",placement:"end",offsetValue:40}},H={isOpen:!1,initialFocus:"menu",placement:"bottom-start",offsetValue:0,anchorRef:{current:null}},G=t.forwardRef((({children:e,...t},s)=>{const{contextMenuConfig:n}=t,i=o.useRef(null),{currentItemOverride:a,updateCurrentItemOverride:l}=(e=>{const r=o.useRef(),t=o.useRef();t.current!==e&&(t.current=e,r.current=e);const s=o.useCallback((e=>{r.current={rowKey:e}}),[]);return{currentItemOverride:r.current,updateCurrentItemOverride:s}})(t.currentItemOverride),c=t.data?t.data.map((e=>({data:e,metadata:{key:t.getRowKey(e)}}))):null,f=t.onLoadMore?t.onLoadMore:()=>{},I=c?{offset:0,data:c,sizePrecision:t.hasMore?"atLeast":"exact",totalSize:c.length}:null;o.useImperativeHandle(s,(()=>({getScrollPosition:()=>i.current?m.getScrollPosition(i.current):{y:0},focus:()=>{i.current&&i.current.focus()}})));const g=null!=t.onReorder,{reorderProps:x,reorderItemProps:R,reorderContext:b,reorderInstructionsId:h,reorderInstructions:M}=(({onReorder:e,rootRef:r,viewportConfig:t})=>{const s=null!=e,[n,i]=o.useState(void 0),{reorderProps:a,reorderContext:l,reorderInstructionsId:c,reorderInstructions:d}=y.useReorderable({onReorder:e,rootRef:r,itemSelector:C.LIST_ITEM_SELECTOR,isDisabled:!s,columns:1}),u=o.useRef(!1);o.useEffect((()=>{if(s&&u.current){const e=r.current,o=p.findElementByKey(e,l.currentItemKey.current,C.LIST_ITEM_SELECTOR);if(o){const r=t?.scrollerRef.current||e;C.scrollToVisible(o,r,0),u.current=!1}}}));const m=o.useMemo((()=>({dragKey:n,setDragKey:i,onReorder:e,rootRef:r})),[n,e,r]);return s?{reorderProps:S.mergeProps({onKeyDown:e=>{s&&("ArrowUp"===e.key||"ArrowDown"===e.key)&&(e.metaKey||e.ctrlKey)&&e.shiftKey&&(u.current=!0,a.onKeyDown?.(e))},onDragOver:e=>{void 0!==n&&(u.current=!1,p.dragToScroll(e,void 0!==n,r.current))}}),reorderItemProps:m,reorderContext:l,reorderInstructionsId:c,reorderInstructions:d}:{reorderProps:a,reorderContext:l,reorderInstructionsId:c,reorderInstructions:d}})({onReorder:t.onReorder,rootRef:i,viewportConfig:t.viewportConfig}),{triggerProps:v,menuProps:T,contextMenuContext:E,notifyCurrentKeyChanged:L}=((e,r,t,s)=>{const[n,i]=o.useState(),[a,l]=o.useState(H),c=o.useRef(),{triggerProps:d}=F.useContextMenuGesture((({gesture:r,anchor:o,target:n})=>{let a=o;if("keyboard"===r){a=p.findElementByKey(t.current,c.current,C.LIST_ITEM_SELECTOR)||o;const r=A.findItemContext(c.current,e);i(r)}else{const r=p.keyExtractor(n,C.LIST_ITEM_SELECTOR),t=A.findItemContext(r,e);i(t),s(r)}l({...B[r],anchorRef:{current:a},isOpen:!0})}),{isDisabled:!r}),u=o.useCallback((e=>{"dismissed"!==e.reason&&"itemAction"!==e.reason||t.current?.focus({preventScroll:!0}),l({...H})}),[t]);return{menuProps:{...a,onClose:u},onClose:u,contextMenuContext:n,triggerProps:d,notifyCurrentKeyChanged:e=>{c.current=e.value}}})(I,n,i,l),P=e=>{t.onPersistCurrentItem?.(e),L(e)},O=o.useCallback((t=>r.jsx(U,{...R,itemKey:t.metadata.key,children:e(t)})),[e,R]);if(g&&R)return r.jsxs(r.Fragment,{children:[r.jsxs(d.ReorderableContext.Provider,{value:b,children:[r.jsx(m.List,{...t,"aria-describedby":h,contextMenuTriggerProps:v,reorderProps:x,onLoadRange:f,scrollerRef:i,data:I,currentItemOverride:a,onPersistCurrentItem:P,children:O}),r.jsx("span",{id:h,children:r.jsx(u.HiddenAccessible,{children:M})})]}),n&&r.jsx(V,{...T,testId:t.testId?t.testId+"-menu":void 0,contextMenuConfig:n,contextMenuContext:E})]});return r.jsxs(r.Fragment,{children:[r.jsx(m.List,{...t,loadingIndicator:t.skeletonRenderer?(k=t.skeletonRenderer,r.jsx(m.SkeletonContainer,{minimumCount:25,children:e=>k({loadingStatus:"initial",index:e})})):void 0,loadMoreIndicator:t.skeletonRenderer?(e=>r.jsx("div",{class:N.LOADMORE_STYLE_CLASS,children:r.jsx(m.SkeletonContainer,{minimumCount:3,children:r=>e({loadingStatus:"loadMore",index:r})})}))(t.skeletonRenderer):void 0,onLoadRange:f,scrollerRef:i,data:I,contextMenuTriggerProps:v,currentItemOverride:a,onPersistCurrentItem:P,children:e}),n&&r.jsx(V,{...T,contextMenuConfig:n,contextMenuContext:E,testId:t.testId?t.testId+"-menu":void 0})]});var k}));e.ListView=G}));
|
|
2
|
+
//# sourceMappingURL=ListView-02a92d18.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListView-2678b2af.js","sources":["../../src/UNSAFE_ListView/ListViewReorderableItem.tsx","../../src/UNSAFE_ListView/ListViewContextMenu.tsx","../../src/UNSAFE_ListView/useListViewContextMenu.ts","../../src/UNSAFE_ListView/ListView.tsx","../../src/UNSAFE_ListView/useListViewCurrentItemOverride.tsx","../../src/UNSAFE_ListView/useListViewReorder.ts"],"sourcesContent":["import { memo } from 'preact/compat';\nimport { useRef, useCallback } from 'preact/hooks';\nimport { useReorderableItem } from '../hooks/PRIVATE_useReorderable';\nimport { ReorderableItemProps } from '../UNSAFE_Collection/Reorderable.types';\nimport { LIST_ITEM_SELECTOR } from '../PRIVATE_List';\nimport { classNames } from '../utils/UNSAFE_classNames';\nimport { styles } from './themes/ListViewStyles.css';\nimport { isKeyDefined } from '../utils/UNSAFE_keys';\n\nexport type ListReorderableItemProps<K> = ReorderableItemProps<K>;\n\n/**\n * A private item that will be used by ReorderableCardFlexView, location TBD (could be moved to PRIVATE_CardFlexView)\n */\nexport function ListViewReorderableItem<K extends string | number>({\n children,\n dragKey,\n setDragKey,\n onReorder,\n rootRef,\n itemKey\n}: ListReorderableItemProps<K> & { itemKey: K }) {\n const itemRef = useRef<HTMLDivElement | null>(null);\n const itemStyles = {\n itemOverlayFront: styles.reorderableItemOverlayFront,\n itemOverlayRear: styles.reorderableItemOverlayRear,\n itemDragger: styles.reorderableItemDragger\n };\n const getItem = () => itemRef?.current?.closest(LIST_ITEM_SELECTOR);\n const setTransferData = useCallback(\n (event: DragEvent) => {\n event.dataTransfer?.setData('text/listview-items-key', JSON.stringify(itemKey));\n },\n [itemKey]\n );\n const { rootProps, isDragged, overlayZoneBeforeProps, overlayZoneAfterProps } =\n useReorderableItem({\n isDisabled: onReorder ? false : true,\n dragKey,\n setDragKey,\n onReorder,\n rootRef,\n ref: itemRef,\n getItem,\n setTransferData,\n itemStyles,\n itemSelector: LIST_ITEM_SELECTOR,\n isVertical: true\n });\n const classes = classNames([rootProps?.class, styles.reorderableItemDnd]);\n\n return (\n <div {...rootProps} class={classes}>\n {children}\n {!isDragged && isKeyDefined(dragKey) && (\n <>\n <div {...overlayZoneBeforeProps}></div>\n <div {...overlayZoneAfterProps}></div>\n </>\n )}\n </div>\n );\n}\n\nexport const MemoizeListViewReorderableItem = memo(\n ListViewReorderableItem,\n <K,>(prev: ListReorderableItemProps<K>, next: ListReorderableItemProps<K>) => {\n if (prev && next) {\n return prev.children === next.children && prev.dragKey === next.dragKey;\n }\n return false;\n }\n);\n","/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\nimport { ComponentChildren, ComponentProps } from 'preact';\n\nimport { ListItemContext } from '#UNSAFE_Collection';\nimport { Menu } from '#UNSAFE_Menu';\nimport { ListViewContextMenuConfig } from './List.types';\nimport { isMenuChildrenFalsy } from '#UNSAFE_Menu/menuUtils';\n\nexport type Props<K extends string | number, D> = Omit<ComponentProps<typeof Menu>, 'children'> & {\n contextMenuConfig: ListViewContextMenuConfig<K, D>;\n} & { contextMenuContext: ListItemContext<K, D> } & {\n testId: ComponentProps<typeof Menu>['testId'];\n};\n\n/**\n * The internal component used to render a custom context menu\n */\nexport function ListViewContextMenu<K extends string | number, D>({\n contextMenuConfig,\n testId,\n contextMenuContext,\n ...menuProps\n}: Props<K, D>) {\n const accessibleLabel = contextMenuConfig.accessibleLabel;\n\n let menuItems: ComponentChildren;\n // Important to call items renderer only when isOpen is true so we know there is a contextMenuContext\n if (menuProps.isOpen) {\n menuItems = contextMenuConfig.itemsRenderer(contextMenuContext);\n if (isMenuChildrenFalsy(menuItems)) {\n return null;\n }\n } else {\n menuItems = null;\n }\n\n return (\n <Menu\n {...menuProps}\n {...(accessibleLabel && {\n 'aria-label': accessibleLabel\n })}\n testId={testId}>\n {menuItems}\n </Menu>\n );\n}\n","import type { ComponentProps, RefObject } from 'preact';\nimport { useCallback, useState, useRef } from 'preact/hooks';\n\nimport { DataState, ListItemContext, CurrentKeyDetail } from '#UNSAFE_Collection';\nimport { Menu } from '#UNSAFE_Menu';\nimport { findItemContext } from '#hooks/PRIVATE_useItemAction';\nimport { useContextMenuGesture } from '#hooks/UNSAFE_useContextMenuGesture';\nimport { findElementByKey, keyExtractor } from '#utils/PRIVATE_collectionUtils';\nimport { ListView } from './ListView';\nimport { LIST_ITEM_SELECTOR } from '#PRIVATE_List';\n\ntype MenuProps = Pick<\n ComponentProps<typeof Menu>,\n 'anchorRef' | 'initialFocus' | 'placement' | 'offsetValue' | 'isOpen'\n>;\n\nconst TOUCH_OFFSET_VALUE = 40;\n\nconst menuPropGestureStates: Record<\n 'mouse' | 'keyboard' | 'touch',\n Omit<Required<MenuProps>, 'anchorRef' | 'isOpen'>\n> = {\n mouse: {\n initialFocus: 'menu',\n placement: 'bottom-start',\n offsetValue: 0\n },\n keyboard: {\n initialFocus: 'firstItem',\n placement: 'bottom-start',\n offsetValue: 0\n },\n touch: {\n initialFocus: 'firstItem',\n placement: 'end',\n offsetValue: TOUCH_OFFSET_VALUE\n }\n};\n\nconst initialMenuProps: MenuProps = {\n isOpen: false,\n initialFocus: 'menu',\n placement: 'bottom-start',\n offsetValue: 0,\n anchorRef: { current: null }\n};\n\ntype ListViewProps<K extends string | number, D> = ComponentProps<typeof ListView<K, D>>;\n\nexport const useListViewContextMenu = <K extends string | number, D>(\n dataState: DataState<K, D> | null,\n contextMenuConfig: ListViewProps<K, D>['contextMenuConfig'],\n scrollListRef: RefObject<HTMLElement | null>,\n updateCurrentKey: (key: K) => void\n) => {\n /*Context Menu section\n TODO: A version of context Menu listview will be merged using useContextMenuGesture instead. Once it's merged we\n can go back to this to create a hook or utility that could be share among all collection comps. JET-60320\n */\n\n /*\n Steps to open a menu:\n 1.- useContextMenu handler is called when menu is supposed to be opened.\n 2.- We set contextMenuContext when contextMenuRenderer is called.\n 3.- We dispatch opening the menu with the correct anchor.\n 5.- Menu receives updated props and updated contextMenuContext.\n 6.- Menu is opened.\n\n */\n\n //Supposed to be updated when menu is about to be opened\n //We set an initial key value for the context menu context, to allow user use object destructuring inside the\n //contextMenuRenderer. It doesn't matter if the key is not correct at the initial rendering since menu starts\n //being closed always\n const [contextMenuContext, setContextMenuContext] = useState<ListItemContext<K, D>>();\n\n const [menuProps, setMenuProps] = useState<MenuProps>(initialMenuProps);\n\n const currentKeyRef = useRef<K>();\n const notifyCurrentKeyChanged = (detail: CurrentKeyDetail<K>) => {\n currentKeyRef.current = detail.value;\n };\n\n const { triggerProps } = useContextMenuGesture(\n ({ gesture, anchor, target }) => {\n let anchorBasedOnGesture = anchor;\n if (gesture === 'keyboard') {\n //We find the element where the position of the menu is going to be based of\n const elem = findElementByKey(\n scrollListRef.current as HTMLElement,\n currentKeyRef.current as K,\n LIST_ITEM_SELECTOR\n );\n\n //We set the correct anchor\n anchorBasedOnGesture = elem ? elem : anchor;\n\n const context = findItemContext(\n currentKeyRef.current as K,\n dataState as DataState<string | number | null, D>\n );\n\n setContextMenuContext(context as ListItemContext<K, D>);\n } else {\n //We search for the key using the target of the event\n const key = keyExtractor(target as HTMLElement, LIST_ITEM_SELECTOR);\n\n const context = findItemContext(key, dataState as DataState<string | number | null, D>);\n\n setContextMenuContext(context as ListItemContext<K, D>);\n\n //We update the key so when we close logical focus is on the correct item\n updateCurrentKey(key as K);\n }\n setMenuProps({\n ...menuPropGestureStates[gesture],\n anchorRef: { current: anchorBasedOnGesture },\n isOpen: true\n });\n },\n {\n isDisabled: !contextMenuConfig //If there is no a context menu renderer we disable the hook\n }\n );\n\n const handleCloseContextMenu = useCallback<Required<ComponentProps<typeof Menu>>['onClose']>(\n (detail) => {\n /*\n TODO: Focus ring should be visible when context menu was closed because of selecting an item using keyboard,\n but should not be visible when the selection was done using mouse or touch. This would probably means menu\n onClose API is going to be changed a little bit so we can satisfy this requirement. JET-62372\n */\n //Focus has to be set on the current target that was obtained\n //during context menu gesture when menu is dismissed or item is \"selected\"\n if (detail.reason === 'dismissed' || detail.reason === 'itemAction') {\n scrollListRef.current?.focus({ preventScroll: true });\n }\n // We close the menu.The only prop that matters here is isOpen\n setMenuProps({ ...initialMenuProps });\n },\n [scrollListRef]\n );\n\n return {\n menuProps: { ...menuProps, onClose: handleCloseContextMenu },\n onClose: handleCloseContextMenu,\n contextMenuContext: contextMenuContext as ListItemContext<K, D>,\n triggerProps,\n notifyCurrentKeyChanged\n } as const;\n};\n","/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\nimport { ComponentChildren, JSX } from 'preact';\nimport { ForwardedRef, forwardRef } from 'preact/compat';\nimport { useCallback, useImperativeHandle, useRef } from 'preact/hooks';\nimport { ReorderableContext } from '../hooks/PRIVATE_useReorderable';\nimport { DataState, CurrentKeyDetail, ListItemRendererContext } from '../UNSAFE_Collection';\nimport { HiddenAccessible } from '../UNSAFE_HiddenAccessible';\nimport { List, SkeletonContainer } from '../PRIVATE_List';\nimport {\n ListProps,\n ListViewContextMenuConfig,\n ListViewHandle,\n SkeletonRendererContext\n} from './List.types';\nimport { getScrollPosition } from './ScrollPositionUtils';\nimport { MemoizeListViewReorderableItem } from './ListViewReorderableItem';\nimport { useListViewReorder } from './useListViewReorder';\nimport { ListViewContextMenu } from './ListViewContextMenu';\nimport { useListViewContextMenu } from './useListViewContextMenu';\nimport { useListViewCurrentItemOverride } from './useListViewCurrentItemOverride';\nimport { LOADMORE_STYLE_CLASS } from '../PRIVATE_LoadMoreCollection';\n\n/**\n * Props specific to non-virtualized ListView\n */\ntype NonVirtualizedListProps<K, D> = {\n /**\n * The data that is used to render each item in ListView. If the value is null, then ListView will show nothing\n * if hasMore is false, or loading indicator if hasMore is true.\n */\n data: D[] | null;\n /**\n * A callback function to extract the key which is used to identify the item.\n */\n getRowKey: (data: D) => K;\n /**\n * Whether there are more data available to load. By default this returns false.\n */\n hasMore?: boolean;\n /**\n * An optional callback function which is invoked when user scrolls to the end of the list.\n */\n onLoadMore?: () => void;\n\n /**\n * Configuration used to specify a context menu.\n */\n contextMenuConfig?: ListViewContextMenuConfig<K, D>;\n};\n\n/**\n * Props for the ListView Component\n */\nexport type Props<K, D> = Pick<\n ListProps<K, D>,\n | 'aria-label'\n | 'aria-labelledby'\n | 'aria-describedby'\n | 'children'\n | 'gridlines'\n | 'currentItemOverride'\n | 'onPersistCurrentItem'\n | 'onItemAction'\n | 'onSelectionChange'\n | 'promotedSection'\n | 'selectedKeys'\n | 'selectionMode'\n | 'viewportConfig'\n | 'testId'\n | 'scrollPositionOverride'\n | 'onReorder'\n | 'itemPadding'\n | 'itemEnterKeyFocusBehavior'\n | 'skeletonRenderer'\n> &\n NonVirtualizedListProps<K, D>;\n/**\n * A list view displays data items as a list or a grid with highly interactive features.\n */\nexport const ListView = forwardRef(\n <K extends string | number, D>(\n { children, ...props }: Props<K, D>,\n ref?: ForwardedRef<ListViewHandle<K>>\n ) => {\n const { contextMenuConfig } = props;\n const listRef = useRef<HTMLDivElement | null>(null);\n\n const { currentItemOverride, updateCurrentItemOverride } = useListViewCurrentItemOverride(\n props.currentItemOverride\n );\n\n const dataMetadata = props.data\n ? props.data.map((aData: D) => {\n const key = props.getRowKey(aData);\n return { data: aData, metadata: { key } };\n })\n : null;\n\n const loadRange = props.onLoadMore ? props.onLoadMore : () => {};\n const dataState = dataMetadata\n ? ({\n offset: 0,\n data: dataMetadata,\n sizePrecision: props.hasMore ? 'atLeast' : 'exact',\n totalSize: dataMetadata.length\n } as DataState<K, D>)\n : null;\n\n useImperativeHandle(ref!, () => ({\n getScrollPosition: () => {\n if (listRef.current) {\n return getScrollPosition(listRef.current);\n }\n return { y: 0 };\n },\n focus: () => {\n if (listRef.current) {\n listRef.current.focus();\n }\n }\n }));\n\n /**\n * Reorder Section\n */\n const isReorderEnabled = props.onReorder != undefined;\n const {\n reorderProps,\n reorderItemProps,\n reorderContext,\n reorderInstructionsId,\n reorderInstructions\n } = useListViewReorder({\n onReorder: props.onReorder,\n rootRef: listRef,\n viewportConfig: props.viewportConfig\n });\n\n const { triggerProps, menuProps, contextMenuContext, notifyCurrentKeyChanged } =\n useListViewContextMenu(dataState, contextMenuConfig, listRef, updateCurrentItemOverride);\n\n const onPersistCurrentItem = (detail: CurrentKeyDetail<K>) => {\n props.onPersistCurrentItem?.(detail);\n notifyCurrentKeyChanged(detail);\n };\n\n const reorderableItemRenderer = useCallback(\n (context: ListItemRendererContext<K, D>) => (\n <MemoizeListViewReorderableItem {...reorderItemProps} itemKey={context.metadata.key}>\n {children(context)}\n </MemoizeListViewReorderableItem>\n ),\n [children, reorderItemProps]\n );\n\n if (isReorderEnabled && reorderItemProps) {\n return (\n <>\n <ReorderableContext.Provider value={reorderContext}>\n <List\n {...props}\n aria-describedby={reorderInstructionsId}\n contextMenuTriggerProps={triggerProps}\n reorderProps={reorderProps}\n onLoadRange={loadRange}\n scrollerRef={listRef}\n data={dataState}\n currentItemOverride={currentItemOverride}\n onPersistCurrentItem={onPersistCurrentItem}>\n {reorderableItemRenderer}\n </List>\n <span id={reorderInstructionsId}>\n <HiddenAccessible>{reorderInstructions}</HiddenAccessible>\n </span>\n </ReorderableContext.Provider>\n {contextMenuConfig && (\n <ListViewContextMenu\n {...menuProps}\n testId={props.testId ? props.testId + '-menu' : undefined}\n contextMenuConfig={contextMenuConfig}\n contextMenuContext={contextMenuContext}\n />\n )}\n </>\n );\n }\n\n const customInitialSkeleton = (\n skeletonRenderer: (context: SkeletonRendererContext) => ComponentChildren\n ) => {\n return (\n <SkeletonContainer minimumCount={25}>\n {(index) => {\n const context: SkeletonRendererContext = {\n loadingStatus: 'initial',\n index: index\n };\n return skeletonRenderer(context);\n }}\n </SkeletonContainer>\n );\n };\n\n const customLoadMoreSkeleton = (\n skeletonRenderer: (context: SkeletonRendererContext) => ComponentChildren\n ) => {\n return (\n <div class={LOADMORE_STYLE_CLASS}>\n <SkeletonContainer minimumCount={3}>\n {(index) => {\n const context: SkeletonRendererContext = {\n loadingStatus: 'loadMore',\n index: index\n };\n return skeletonRenderer(context);\n }}\n </SkeletonContainer>\n </div>\n );\n };\n\n return (\n <>\n <List\n {...props}\n loadingIndicator={\n props.skeletonRenderer ? customInitialSkeleton(props.skeletonRenderer) : undefined\n }\n loadMoreIndicator={\n props.skeletonRenderer ? customLoadMoreSkeleton(props.skeletonRenderer) : undefined\n }\n onLoadRange={loadRange}\n scrollerRef={listRef}\n data={dataState}\n contextMenuTriggerProps={triggerProps}\n currentItemOverride={currentItemOverride}\n onPersistCurrentItem={onPersistCurrentItem}>\n {children}\n </List>\n {contextMenuConfig && (\n <ListViewContextMenu\n {...menuProps}\n contextMenuConfig={contextMenuConfig}\n contextMenuContext={contextMenuContext}\n testId={props.testId ? props.testId + '-menu' : undefined}\n />\n )}\n </>\n );\n }\n) as <K extends string | number, D>(\n props: Props<K, D> & { ref?: ForwardedRef<ListViewHandle<K>> }\n) => JSX.Element;\n","import { useCallback, useRef } from 'preact/hooks';\nimport { Item as CurrentItem } from '#UNSAFE_Collection';\nimport { ListProps } from './List.types';\n\n/**\n * This hook handles the currentItemOverride passing to PRIVATE_List layer.\n *\n * If the app provided new value for 'currentItemOverride', we pass that down to PRIVATE_List layer;\n * otherwise, we will pass down the value of internal override, which would be the value\n * updated by useListViewContextMenu hook\n *\n * @param currentItemOverride\n */\nexport const useListViewCurrentItemOverride = <K extends string | number, D>(\n currentItemOverride: ListProps<K, D>['currentItemOverride']\n) => {\n // the override that will be passed down to PRIVATE_List layer\n const listOverrideRef = useRef<CurrentItem<K>>();\n\n // track the currentItemOverride attribute set by app\n const appOverrideRef = useRef<CurrentItem<K>>();\n if (appOverrideRef.current !== currentItemOverride) {\n appOverrideRef.current = currentItemOverride;\n listOverrideRef.current = currentItemOverride;\n }\n\n // track the internal override updated by useListViewContextMenu hook\n // we can just update ref here since the hook will trigger a state update for its context, which will trigger a rerender\n const updateCurrentItemOverride = useCallback((key: K) => {\n listOverrideRef.current = { rowKey: key };\n }, []);\n\n return {\n currentItemOverride: listOverrideRef.current,\n updateCurrentItemOverride\n };\n};\n","import type { RefObject } from 'preact';\nimport { useMemo, useState, useEffect, useRef } from 'preact/hooks';\nimport { mergeProps } from '../utils/UNSAFE_mergeProps';\nimport { dragToScroll, findElementByKey } from '../utils/PRIVATE_collectionUtils';\nimport { ViewportConfig } from '../hooks/UNSAFE_useViewportIntersect';\nimport { useReorderable } from '../hooks/PRIVATE_useReorderable';\nimport { scrollToVisible, LIST_ITEM_SELECTOR } from '../PRIVATE_List';\nimport { ListProps } from './List.types';\n\ntype useListViewReorderProps<K, D> = Pick<ListProps<K, D>, 'onReorder'> & {\n rootRef: RefObject<HTMLDivElement>;\n viewportConfig?: ViewportConfig;\n};\n\nexport const useListViewReorder = <K extends string | number, D>({\n onReorder,\n rootRef,\n viewportConfig\n}: useListViewReorderProps<K, D>) => {\n const isReorderEnabled = onReorder != undefined;\n\n const [dragKey, setDragKey] = useState<K | undefined>(undefined);\n const { reorderProps, reorderContext, reorderInstructionsId, reorderInstructions } =\n useReorderable({\n onReorder,\n rootRef,\n itemSelector: LIST_ITEM_SELECTOR,\n isDisabled: !isReorderEnabled,\n columns: 1\n });\n\n // ensure the current item is scrolled into view during keyboard reordering,\n // disable that during mouse reordering\n const reorderScrollIntoView = useRef(false);\n useEffect(() => {\n if (isReorderEnabled && reorderScrollIntoView.current) {\n const rootElement = rootRef.current as HTMLElement;\n const elem = findElementByKey(\n rootElement,\n reorderContext.currentItemKey.current as K,\n LIST_ITEM_SELECTOR\n );\n if (elem) {\n const scroller = viewportConfig?.scrollerRef.current || rootElement;\n // make sure item is visible\n scrollToVisible(elem, scroller, 0);\n reorderScrollIntoView.current = false;\n }\n }\n });\n\n const reorderItemProps = useMemo(() => {\n return { dragKey, setDragKey, onReorder, rootRef };\n }, [dragKey, onReorder, rootRef]);\n\n if (!isReorderEnabled) {\n return {\n reorderProps,\n reorderContext,\n reorderInstructionsId,\n reorderInstructions\n } as const;\n }\n\n const handleKeyDown = (event: KeyboardEvent) => {\n // listview only do keyboard reordering with arrow up/down keys\n if (\n isReorderEnabled &&\n (event.key === 'ArrowUp' || event.key === 'ArrowDown') &&\n (event.metaKey || event.ctrlKey) &&\n event.shiftKey\n ) {\n reorderScrollIntoView.current = true;\n reorderProps.onKeyDown?.(event);\n }\n };\n\n const handleDragOver = (event: DragEvent) => {\n if (dragKey !== undefined) {\n reorderScrollIntoView.current = false;\n dragToScroll(event, dragKey !== undefined, rootRef.current);\n }\n };\n\n const reorderEventProps = mergeProps({ onKeyDown: handleKeyDown, onDragOver: handleDragOver });\n\n return {\n reorderProps: reorderEventProps,\n reorderItemProps,\n reorderContext,\n reorderInstructionsId,\n reorderInstructions\n } as const;\n};\n"],"names":["MemoizeListViewReorderableItem","memo","children","dragKey","setDragKey","onReorder","rootRef","itemKey","itemRef","useRef","itemStyles","itemOverlayFront","styles","reorderableItemOverlayFront","itemOverlayRear","reorderableItemOverlayRear","itemDragger","reorderableItemDragger","setTransferData","useCallback","event","dataTransfer","setData","JSON","stringify","rootProps","isDragged","overlayZoneBeforeProps","overlayZoneAfterProps","useReorderableItem","isDisabled","ref","getItem","current","closest","LIST_ITEM_SELECTOR","itemSelector","isVertical","classes","classNames","class","reorderableItemDnd","_jsxs","isKeyDefined","jsxs","_Fragment","Fragment","_jsx","jsx","prev","next","ListViewContextMenu","contextMenuConfig","testId","contextMenuContext","menuProps","accessibleLabel","menuItems","isOpen","itemsRenderer","isMenuChildrenFalsy","Menu","menuPropGestureStates","mouse","initialFocus","placement","offsetValue","keyboard","touch","initialMenuProps","anchorRef","ListView","forwardRef","props","listRef","currentItemOverride","updateCurrentItemOverride","listOverrideRef","appOverrideRef","key","rowKey","useListViewCurrentItemOverride","dataMetadata","data","map","aData","metadata","getRowKey","loadRange","onLoadMore","dataState","offset","sizePrecision","hasMore","totalSize","length","useImperativeHandle","getScrollPosition","y","focus","isReorderEnabled","undefined","reorderProps","reorderItemProps","reorderContext","reorderInstructionsId","reorderInstructions","viewportConfig","useState","useReorderable","columns","reorderScrollIntoView","useEffect","rootElement","elem","findElementByKey","currentItemKey","scroller","scrollerRef","scrollToVisible","useMemo","mergeProps","onKeyDown","metaKey","ctrlKey","shiftKey","onDragOver","dragToScroll","useListViewReorder","triggerProps","notifyCurrentKeyChanged","scrollListRef","updateCurrentKey","setContextMenuContext","setMenuProps","currentKeyRef","useContextMenuGesture","gesture","anchor","target","anchorBasedOnGesture","context","findItemContext","keyExtractor","handleCloseContextMenu","detail","reason","preventScroll","onClose","value","useListViewContextMenu","onPersistCurrentItem","reorderableItemRenderer","ReorderableContext","Provider","List","contextMenuTriggerProps","onLoadRange","id","HiddenAccessible","loadingIndicator","skeletonRenderer","SkeletonContainer","minimumCount","index","loadingStatus","loadMoreIndicator","LOADMORE_STYLE_CLASS","customLoadMoreSkeleton"],"mappings":"wvCAgEO,MAAMA,EAAiCC,EAAAA,MAlD9B,UAAmDC,SACjEA,EAAQC,QACRA,EAAOC,WACPA,EAAUC,UACVA,EAASC,QACTA,EAAOC,QACPA,IAEA,MAAMC,EAAUC,SAA8B,MACxCC,EAAa,CACjBC,iBAAkBC,EAAMA,OAACC,4BACzBC,gBAAiBF,EAAMA,OAACG,2BACxBC,YAAaJ,EAAMA,OAACK,wBAGhBC,EAAkBC,eACrBC,IACCA,EAAMC,cAAcC,QAAQ,0BAA2BC,KAAKC,UAAUjB,GAAS,GAEjF,CAACA,KAEGkB,UAAEA,EAASC,UAAEA,EAASC,uBAAEA,EAAsBC,sBAAEA,GACpDC,EAAAA,mBAAmB,CACjBC,YAAYzB,EACZF,UACAC,aACAC,YACAC,UACAyB,IAAKvB,EACLwB,QAfY,IAAMxB,GAASyB,SAASC,QAAQC,EAAkBA,oBAgB9DjB,kBACAR,aACA0B,aAAcD,EAAkBA,mBAChCE,YAAY,IAEVC,EAAUC,EAAAA,WAAW,CAACd,GAAWe,MAAO5B,EAAMA,OAAC6B,qBAErD,OACEC,EAAAA,KAAA,MAAA,IAASjB,EAAWe,MAAOF,EAAOpC,SAAA,CAC/BA,GACCwB,GAAaiB,EAAAA,aAAaxC,IAC1BuC,EACEE,KAAAC,EAAAC,SAAA,C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BAAkB,CAAAC,aAAc,GAC9BjK,SAACkK,GAKOH,EAJkC,CACvCI,cAAe,UACfD,MAAOA,YA+BgE/D,EAE3EiE,kBACE7F,EAAMwF,iBA1BiB,CAC7BA,GAGElH,EAAKC,IAAA,MAAA,CAAAR,MAAO+H,EAAoBA,8BAC9BxH,MAACmH,EAAAA,kBAAkB,CAAAC,aAAc,EAACjK,SAC9BkK,GAKOH,EAJkC,CACvCI,cAAe,WACfD,MAAOA,QAiBcI,CAAuB/F,EAAMwF,uBAAoB5D,EAE5EwD,YAAarE,EACb8B,YAAa5C,EACbS,KAAMO,EACNkE,wBAAyB3B,EACzBtD,oBAAqBA,EACrB4E,qBAAsBA,WACrBrJ,IAEFkD,GACCL,EAAAA,IAACI,EAAmB,IACdI,EACJH,kBAAmBA,EACnBE,mBAAoBA,EACpBD,OAAQoB,EAAMpB,OAASoB,EAAMpB,OAAS,aAAUgD,OAzD1B,IAC5B4D,CA4DA"}
|
|
1
|
+
{"version":3,"file":"ListView-02a92d18.js","sources":["../../src/UNSAFE_ListView/ListViewReorderableItem.tsx","../../src/UNSAFE_ListView/ListViewContextMenu.tsx","../../src/UNSAFE_ListView/useListViewContextMenu.ts","../../src/UNSAFE_ListView/ListView.tsx","../../src/UNSAFE_ListView/useListViewCurrentItemOverride.tsx","../../src/UNSAFE_ListView/useListViewReorder.ts"],"sourcesContent":["import { memo } from 'preact/compat';\nimport { useRef, useCallback } from 'preact/hooks';\nimport { useReorderableItem } from '../hooks/PRIVATE_useReorderable';\nimport { ReorderableItemProps } from '../UNSAFE_Collection/Reorderable.types';\nimport { LIST_ITEM_SELECTOR } from '../PRIVATE_List';\nimport { classNames } from '../utils/UNSAFE_classNames';\nimport { styles } from './themes/ListViewStyles.css';\nimport { isKeyDefined } from '../utils/UNSAFE_keys';\n\nexport type ListReorderableItemProps<K> = ReorderableItemProps<K>;\n\n/**\n * A private item that will be used by ReorderableCardFlexView, location TBD (could be moved to PRIVATE_CardFlexView)\n */\nexport function ListViewReorderableItem<K extends string | number>({\n children,\n dragKey,\n setDragKey,\n onReorder,\n rootRef,\n itemKey\n}: ListReorderableItemProps<K> & { itemKey: K }) {\n const itemRef = useRef<HTMLDivElement | null>(null);\n const itemStyles = {\n itemOverlayFront: styles.reorderableItemOverlayFront,\n itemOverlayRear: styles.reorderableItemOverlayRear,\n itemDragger: styles.reorderableItemDragger\n };\n const getItem = () => itemRef?.current?.closest(LIST_ITEM_SELECTOR);\n const setTransferData = useCallback(\n (event: DragEvent) => {\n event.dataTransfer?.setData('text/listview-items-key', JSON.stringify(itemKey));\n },\n [itemKey]\n );\n const { rootProps, isDragged, overlayZoneBeforeProps, overlayZoneAfterProps } =\n useReorderableItem({\n isDisabled: onReorder ? false : true,\n dragKey,\n setDragKey,\n onReorder,\n rootRef,\n ref: itemRef,\n getItem,\n setTransferData,\n itemStyles,\n itemSelector: LIST_ITEM_SELECTOR,\n isVertical: true\n });\n const classes = classNames([rootProps?.class, styles.reorderableItemDnd]);\n\n return (\n <div {...rootProps} class={classes}>\n {children}\n {!isDragged && isKeyDefined(dragKey) && (\n <>\n <div {...overlayZoneBeforeProps}></div>\n <div {...overlayZoneAfterProps}></div>\n </>\n )}\n </div>\n );\n}\n\nexport const MemoizeListViewReorderableItem = memo(\n ListViewReorderableItem,\n <K,>(prev: ListReorderableItemProps<K>, next: ListReorderableItemProps<K>) => {\n if (prev && next) {\n return prev.children === next.children && prev.dragKey === next.dragKey;\n }\n return false;\n }\n);\n","/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\nimport { ComponentChildren, ComponentProps } from 'preact';\n\nimport { ListItemContext } from '#UNSAFE_Collection';\nimport { Menu } from '#UNSAFE_Menu';\nimport { ListViewContextMenuConfig } from './List.types';\nimport { isMenuChildrenFalsy } from '#UNSAFE_Menu/menuUtils';\n\nexport type Props<K extends string | number, D> = Omit<ComponentProps<typeof Menu>, 'children'> & {\n contextMenuConfig: ListViewContextMenuConfig<K, D>;\n} & { contextMenuContext: ListItemContext<K, D> } & {\n testId: ComponentProps<typeof Menu>['testId'];\n};\n\n/**\n * The internal component used to render a custom context menu\n */\nexport function ListViewContextMenu<K extends string | number, D>({\n contextMenuConfig,\n testId,\n contextMenuContext,\n ...menuProps\n}: Props<K, D>) {\n const accessibleLabel = contextMenuConfig.accessibleLabel;\n\n let menuItems: ComponentChildren;\n // Important to call items renderer only when isOpen is true so we know there is a contextMenuContext\n if (menuProps.isOpen) {\n menuItems = contextMenuConfig.itemsRenderer(contextMenuContext);\n if (isMenuChildrenFalsy(menuItems)) {\n return null;\n }\n } else {\n menuItems = null;\n }\n\n return (\n <Menu\n {...menuProps}\n {...(accessibleLabel && {\n 'aria-label': accessibleLabel\n })}\n testId={testId}>\n {menuItems}\n </Menu>\n );\n}\n","import type { ComponentProps, RefObject } from 'preact';\nimport { useCallback, useState, useRef } from 'preact/hooks';\n\nimport { DataState, ListItemContext, CurrentKeyDetail } from '#UNSAFE_Collection';\nimport { Menu } from '#UNSAFE_Menu';\nimport { findItemContext } from '#hooks/PRIVATE_useItemAction';\nimport { useContextMenuGesture } from '#hooks/UNSAFE_useContextMenuGesture';\nimport { findElementByKey, keyExtractor } from '#utils/PRIVATE_collectionUtils';\nimport { ListView } from './ListView';\nimport { LIST_ITEM_SELECTOR } from '#PRIVATE_List';\n\ntype MenuProps = Pick<\n ComponentProps<typeof Menu>,\n 'anchorRef' | 'initialFocus' | 'placement' | 'offsetValue' | 'isOpen'\n>;\n\nconst TOUCH_OFFSET_VALUE = 40;\n\nconst menuPropGestureStates: Record<\n 'mouse' | 'keyboard' | 'touch',\n Omit<Required<MenuProps>, 'anchorRef' | 'isOpen'>\n> = {\n mouse: {\n initialFocus: 'menu',\n placement: 'bottom-start',\n offsetValue: 0\n },\n keyboard: {\n initialFocus: 'firstItem',\n placement: 'bottom-start',\n offsetValue: 0\n },\n touch: {\n initialFocus: 'firstItem',\n placement: 'end',\n offsetValue: TOUCH_OFFSET_VALUE\n }\n};\n\nconst initialMenuProps: MenuProps = {\n isOpen: false,\n initialFocus: 'menu',\n placement: 'bottom-start',\n offsetValue: 0,\n anchorRef: { current: null }\n};\n\ntype ListViewProps<K extends string | number, D> = ComponentProps<typeof ListView<K, D>>;\n\nexport const useListViewContextMenu = <K extends string | number, D>(\n dataState: DataState<K, D> | null,\n contextMenuConfig: ListViewProps<K, D>['contextMenuConfig'],\n scrollListRef: RefObject<HTMLElement | null>,\n updateCurrentKey: (key: K) => void\n) => {\n /*Context Menu section\n TODO: A version of context Menu listview will be merged using useContextMenuGesture instead. Once it's merged we\n can go back to this to create a hook or utility that could be share among all collection comps. JET-60320\n */\n\n /*\n Steps to open a menu:\n 1.- useContextMenu handler is called when menu is supposed to be opened.\n 2.- We set contextMenuContext when contextMenuRenderer is called.\n 3.- We dispatch opening the menu with the correct anchor.\n 5.- Menu receives updated props and updated contextMenuContext.\n 6.- Menu is opened.\n\n */\n\n //Supposed to be updated when menu is about to be opened\n //We set an initial key value for the context menu context, to allow user use object destructuring inside the\n //contextMenuRenderer. It doesn't matter if the key is not correct at the initial rendering since menu starts\n //being closed always\n const [contextMenuContext, setContextMenuContext] = useState<ListItemContext<K, D>>();\n\n const [menuProps, setMenuProps] = useState<MenuProps>(initialMenuProps);\n\n const currentKeyRef = useRef<K>();\n const notifyCurrentKeyChanged = (detail: CurrentKeyDetail<K>) => {\n currentKeyRef.current = detail.value;\n };\n\n const { triggerProps } = useContextMenuGesture(\n ({ gesture, anchor, target }) => {\n let anchorBasedOnGesture = anchor;\n if (gesture === 'keyboard') {\n //We find the element where the position of the menu is going to be based of\n const elem = findElementByKey(\n scrollListRef.current as HTMLElement,\n currentKeyRef.current as K,\n LIST_ITEM_SELECTOR\n );\n\n //We set the correct anchor\n anchorBasedOnGesture = elem ? elem : anchor;\n\n const context = findItemContext(\n currentKeyRef.current as K,\n dataState as DataState<string | number | null, D>\n );\n\n setContextMenuContext(context as ListItemContext<K, D>);\n } else {\n //We search for the key using the target of the event\n const key = keyExtractor(target as HTMLElement, LIST_ITEM_SELECTOR);\n\n const context = findItemContext(key, dataState as DataState<string | number | null, D>);\n\n setContextMenuContext(context as ListItemContext<K, D>);\n\n //We update the key so when we close logical focus is on the correct item\n updateCurrentKey(key as K);\n }\n setMenuProps({\n ...menuPropGestureStates[gesture],\n anchorRef: { current: anchorBasedOnGesture },\n isOpen: true\n });\n },\n {\n isDisabled: !contextMenuConfig //If there is no a context menu renderer we disable the hook\n }\n );\n\n const handleCloseContextMenu = useCallback<Required<ComponentProps<typeof Menu>>['onClose']>(\n (detail) => {\n /*\n TODO: Focus ring should be visible when context menu was closed because of selecting an item using keyboard,\n but should not be visible when the selection was done using mouse or touch. This would probably means menu\n onClose API is going to be changed a little bit so we can satisfy this requirement. JET-62372\n */\n //Focus has to be set on the current target that was obtained\n //during context menu gesture when menu is dismissed or item is \"selected\"\n if (detail.reason === 'dismissed' || detail.reason === 'itemAction') {\n scrollListRef.current?.focus({ preventScroll: true });\n }\n // We close the menu.The only prop that matters here is isOpen\n setMenuProps({ ...initialMenuProps });\n },\n [scrollListRef]\n );\n\n return {\n menuProps: { ...menuProps, onClose: handleCloseContextMenu },\n onClose: handleCloseContextMenu,\n contextMenuContext: contextMenuContext as ListItemContext<K, D>,\n triggerProps,\n notifyCurrentKeyChanged\n } as const;\n};\n","/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\nimport { ComponentChildren, JSX } from 'preact';\nimport { ForwardedRef, forwardRef } from 'preact/compat';\nimport { useCallback, useImperativeHandle, useRef } from 'preact/hooks';\nimport { ReorderableContext } from '../hooks/PRIVATE_useReorderable';\nimport { DataState, CurrentKeyDetail, ListItemRendererContext } from '../UNSAFE_Collection';\nimport { HiddenAccessible } from '../UNSAFE_HiddenAccessible';\nimport { List, SkeletonContainer } from '../PRIVATE_List';\nimport {\n ListProps,\n ListViewContextMenuConfig,\n ListViewHandle,\n SkeletonRendererContext\n} from './List.types';\nimport { getScrollPosition } from './ScrollPositionUtils';\nimport { MemoizeListViewReorderableItem } from './ListViewReorderableItem';\nimport { useListViewReorder } from './useListViewReorder';\nimport { ListViewContextMenu } from './ListViewContextMenu';\nimport { useListViewContextMenu } from './useListViewContextMenu';\nimport { useListViewCurrentItemOverride } from './useListViewCurrentItemOverride';\nimport { LOADMORE_STYLE_CLASS } from '../PRIVATE_LoadMoreCollection';\n\n/**\n * Props specific to non-virtualized ListView\n */\ntype NonVirtualizedListProps<K, D> = {\n /**\n * The data that is used to render each item in ListView. If the value is null, then ListView will show nothing\n * if hasMore is false, or loading indicator if hasMore is true.\n */\n data: D[] | null;\n /**\n * A callback function to extract the key which is used to identify the item.\n */\n getRowKey: (data: D) => K;\n /**\n * Whether there are more data available to load. By default this returns false.\n */\n hasMore?: boolean;\n /**\n * An optional callback function which is invoked when user scrolls to the end of the list.\n */\n onLoadMore?: () => void;\n\n /**\n * Configuration used to specify a context menu.\n */\n contextMenuConfig?: ListViewContextMenuConfig<K, D>;\n};\n\n/**\n * Props for the ListView Component\n */\nexport type Props<K, D> = Pick<\n ListProps<K, D>,\n | 'aria-label'\n | 'aria-labelledby'\n | 'aria-describedby'\n | 'children'\n | 'gridlines'\n | 'currentItemOverride'\n | 'onPersistCurrentItem'\n | 'onItemAction'\n | 'onSelectionChange'\n | 'promotedSection'\n | 'selectedKeys'\n | 'selectionMode'\n | 'viewportConfig'\n | 'testId'\n | 'scrollPositionOverride'\n | 'onReorder'\n | 'itemPadding'\n | 'itemEnterKeyFocusBehavior'\n | 'skeletonRenderer'\n> &\n NonVirtualizedListProps<K, D>;\n/**\n * A list view displays data items as a list or a grid with highly interactive features.\n */\nexport const ListView = forwardRef(\n <K extends string | number, D>(\n { children, ...props }: Props<K, D>,\n ref?: ForwardedRef<ListViewHandle<K>>\n ) => {\n const { contextMenuConfig } = props;\n const listRef = useRef<HTMLDivElement | null>(null);\n\n const { currentItemOverride, updateCurrentItemOverride } = useListViewCurrentItemOverride(\n props.currentItemOverride\n );\n\n const dataMetadata = props.data\n ? props.data.map((aData: D) => {\n const key = props.getRowKey(aData);\n return { data: aData, metadata: { key } };\n })\n : null;\n\n const loadRange = props.onLoadMore ? props.onLoadMore : () => {};\n const dataState = dataMetadata\n ? ({\n offset: 0,\n data: dataMetadata,\n sizePrecision: props.hasMore ? 'atLeast' : 'exact',\n totalSize: dataMetadata.length\n } as DataState<K, D>)\n : null;\n\n useImperativeHandle(ref!, () => ({\n getScrollPosition: () => {\n if (listRef.current) {\n return getScrollPosition(listRef.current);\n }\n return { y: 0 };\n },\n focus: () => {\n if (listRef.current) {\n listRef.current.focus();\n }\n }\n }));\n\n /**\n * Reorder Section\n */\n const isReorderEnabled = props.onReorder != undefined;\n const {\n reorderProps,\n reorderItemProps,\n reorderContext,\n reorderInstructionsId,\n reorderInstructions\n } = useListViewReorder({\n onReorder: props.onReorder,\n rootRef: listRef,\n viewportConfig: props.viewportConfig\n });\n\n const { triggerProps, menuProps, contextMenuContext, notifyCurrentKeyChanged } =\n useListViewContextMenu(dataState, contextMenuConfig, listRef, updateCurrentItemOverride);\n\n const onPersistCurrentItem = (detail: CurrentKeyDetail<K>) => {\n props.onPersistCurrentItem?.(detail);\n notifyCurrentKeyChanged(detail);\n };\n\n const reorderableItemRenderer = useCallback(\n (context: ListItemRendererContext<K, D>) => (\n <MemoizeListViewReorderableItem {...reorderItemProps} itemKey={context.metadata.key}>\n {children(context)}\n </MemoizeListViewReorderableItem>\n ),\n [children, reorderItemProps]\n );\n\n if (isReorderEnabled && reorderItemProps) {\n return (\n <>\n <ReorderableContext.Provider value={reorderContext}>\n <List\n {...props}\n aria-describedby={reorderInstructionsId}\n contextMenuTriggerProps={triggerProps}\n reorderProps={reorderProps}\n onLoadRange={loadRange}\n scrollerRef={listRef}\n data={dataState}\n currentItemOverride={currentItemOverride}\n onPersistCurrentItem={onPersistCurrentItem}>\n {reorderableItemRenderer}\n </List>\n <span id={reorderInstructionsId}>\n <HiddenAccessible>{reorderInstructions}</HiddenAccessible>\n </span>\n </ReorderableContext.Provider>\n {contextMenuConfig && (\n <ListViewContextMenu\n {...menuProps}\n testId={props.testId ? props.testId + '-menu' : undefined}\n contextMenuConfig={contextMenuConfig}\n contextMenuContext={contextMenuContext}\n />\n )}\n </>\n );\n }\n\n const customInitialSkeleton = (\n skeletonRenderer: (context: SkeletonRendererContext) => ComponentChildren\n ) => {\n return (\n <SkeletonContainer minimumCount={25}>\n {(index) => {\n const context: SkeletonRendererContext = {\n loadingStatus: 'initial',\n index: index\n };\n return skeletonRenderer(context);\n }}\n </SkeletonContainer>\n );\n };\n\n const customLoadMoreSkeleton = (\n skeletonRenderer: (context: SkeletonRendererContext) => ComponentChildren\n ) => {\n return (\n <div class={LOADMORE_STYLE_CLASS}>\n <SkeletonContainer minimumCount={3}>\n {(index) => {\n const context: SkeletonRendererContext = {\n loadingStatus: 'loadMore',\n index: index\n };\n return skeletonRenderer(context);\n }}\n </SkeletonContainer>\n </div>\n );\n };\n\n return (\n <>\n <List\n {...props}\n loadingIndicator={\n props.skeletonRenderer ? customInitialSkeleton(props.skeletonRenderer) : undefined\n }\n loadMoreIndicator={\n props.skeletonRenderer ? customLoadMoreSkeleton(props.skeletonRenderer) : undefined\n }\n onLoadRange={loadRange}\n scrollerRef={listRef}\n data={dataState}\n contextMenuTriggerProps={triggerProps}\n currentItemOverride={currentItemOverride}\n onPersistCurrentItem={onPersistCurrentItem}>\n {children}\n </List>\n {contextMenuConfig && (\n <ListViewContextMenu\n {...menuProps}\n contextMenuConfig={contextMenuConfig}\n contextMenuContext={contextMenuContext}\n testId={props.testId ? props.testId + '-menu' : undefined}\n />\n )}\n </>\n );\n }\n) as <K extends string | number, D>(\n props: Props<K, D> & { ref?: ForwardedRef<ListViewHandle<K>> }\n) => JSX.Element;\n","import { useCallback, useRef } from 'preact/hooks';\nimport { Item as CurrentItem } from '#UNSAFE_Collection';\nimport { ListProps } from './List.types';\n\n/**\n * This hook handles the currentItemOverride passing to PRIVATE_List layer.\n *\n * If the app provided new value for 'currentItemOverride', we pass that down to PRIVATE_List layer;\n * otherwise, we will pass down the value of internal override, which would be the value\n * updated by useListViewContextMenu hook\n *\n * @param currentItemOverride\n */\nexport const useListViewCurrentItemOverride = <K extends string | number, D>(\n currentItemOverride: ListProps<K, D>['currentItemOverride']\n) => {\n // the override that will be passed down to PRIVATE_List layer\n const listOverrideRef = useRef<CurrentItem<K>>();\n\n // track the currentItemOverride attribute set by app\n const appOverrideRef = useRef<CurrentItem<K>>();\n if (appOverrideRef.current !== currentItemOverride) {\n appOverrideRef.current = currentItemOverride;\n listOverrideRef.current = currentItemOverride;\n }\n\n // track the internal override updated by useListViewContextMenu hook\n // we can just update ref here since the hook will trigger a state update for its context, which will trigger a rerender\n const updateCurrentItemOverride = useCallback((key: K) => {\n listOverrideRef.current = { rowKey: key };\n }, []);\n\n return {\n currentItemOverride: listOverrideRef.current,\n updateCurrentItemOverride\n };\n};\n","import type { RefObject } from 'preact';\nimport { useMemo, useState, useEffect, useRef } from 'preact/hooks';\nimport { mergeProps } from '../utils/UNSAFE_mergeProps';\nimport { dragToScroll, findElementByKey } from '../utils/PRIVATE_collectionUtils';\nimport { ViewportConfig } from '../hooks/UNSAFE_useViewportIntersect';\nimport { useReorderable } from '../hooks/PRIVATE_useReorderable';\nimport { scrollToVisible, LIST_ITEM_SELECTOR } from '../PRIVATE_List';\nimport { ListProps } from './List.types';\n\ntype useListViewReorderProps<K, D> = Pick<ListProps<K, D>, 'onReorder'> & {\n rootRef: RefObject<HTMLDivElement>;\n viewportConfig?: ViewportConfig;\n};\n\nexport const useListViewReorder = <K extends string | number, D>({\n onReorder,\n rootRef,\n viewportConfig\n}: useListViewReorderProps<K, D>) => {\n const isReorderEnabled = onReorder != undefined;\n\n const [dragKey, setDragKey] = useState<K | undefined>(undefined);\n const { reorderProps, reorderContext, reorderInstructionsId, reorderInstructions } =\n useReorderable({\n onReorder,\n rootRef,\n itemSelector: LIST_ITEM_SELECTOR,\n isDisabled: !isReorderEnabled,\n columns: 1\n });\n\n // ensure the current item is scrolled into view during keyboard reordering,\n // disable that during mouse reordering\n const reorderScrollIntoView = useRef(false);\n useEffect(() => {\n if (isReorderEnabled && reorderScrollIntoView.current) {\n const rootElement = rootRef.current as HTMLElement;\n const elem = findElementByKey(\n rootElement,\n reorderContext.currentItemKey.current as K,\n LIST_ITEM_SELECTOR\n );\n if (elem) {\n const scroller = viewportConfig?.scrollerRef.current || rootElement;\n // make sure item is visible\n scrollToVisible(elem, scroller, 0);\n reorderScrollIntoView.current = false;\n }\n }\n });\n\n const reorderItemProps = useMemo(() => {\n return { dragKey, setDragKey, onReorder, rootRef };\n }, [dragKey, onReorder, rootRef]);\n\n if (!isReorderEnabled) {\n return {\n reorderProps,\n reorderContext,\n reorderInstructionsId,\n reorderInstructions\n } as const;\n }\n\n const handleKeyDown = (event: KeyboardEvent) => {\n // listview only do keyboard reordering with arrow up/down keys\n if (\n isReorderEnabled &&\n (event.key === 'ArrowUp' || event.key === 'ArrowDown') &&\n (event.metaKey || event.ctrlKey) &&\n event.shiftKey\n ) {\n reorderScrollIntoView.current = true;\n reorderProps.onKeyDown?.(event);\n }\n };\n\n const handleDragOver = (event: DragEvent) => {\n if (dragKey !== undefined) {\n reorderScrollIntoView.current = false;\n dragToScroll(event, dragKey !== undefined, rootRef.current);\n }\n };\n\n const reorderEventProps = mergeProps({ onKeyDown: handleKeyDown, onDragOver: handleDragOver });\n\n return {\n reorderProps: reorderEventProps,\n reorderItemProps,\n reorderContext,\n reorderInstructionsId,\n reorderInstructions\n } as const;\n};\n"],"names":["MemoizeListViewReorderableItem","memo","children","dragKey","setDragKey","onReorder","rootRef","itemKey","itemRef","useRef","itemStyles","itemOverlayFront","styles","reorderableItemOverlayFront","itemOverlayRear","reorderableItemOverlayRear","itemDragger","reorderableItemDragger","setTransferData","useCallback","event","dataTransfer","setData","JSON","stringify","rootProps","isDragged","overlayZoneBeforeProps","overlayZoneAfterProps","useReorderableItem","isDisabled","ref","getItem","current","closest","LIST_ITEM_SELECTOR","itemSelector","isVertical","classes","classNames","class","reorderableItemDnd","_jsxs","isKeyDefined","jsxs","_Fragment","Fragment","_jsx","jsx","prev","next","ListViewContextMenu","contextMenuConfig","testId","contextMenuContext","menuProps","accessibleLabel","menuItems","isOpen","itemsRenderer","isMenuChildrenFalsy","Menu","menuPropGestureStates","mouse","initialFocus","placement","offsetValue","keyboard","touch","initialMenuProps","anchorRef","ListView","forwardRef","props","listRef","currentItemOverride","updateCurrentItemOverride","listOverrideRef","appOverrideRef","key","rowKey","useListViewCurrentItemOverride","dataMetadata","data","map","aData","metadata","getRowKey","loadRange","onLoadMore","dataState","offset","sizePrecision","hasMore","totalSize","length","useImperativeHandle","getScrollPosition","y","focus","isReorderEnabled","undefined","reorderProps","reorderItemProps","reorderContext","reorderInstructionsId","reorderInstructions","viewportConfig","useState","useReorderable","columns","reorderScrollIntoView","useEffect","rootElement","elem","findElementByKey","currentItemKey","scroller","scrollerRef","scrollToVisible","useMemo","mergeProps","onKeyDown","metaKey","ctrlKey","shiftKey","onDragOver","dragToScroll","useListViewReorder","triggerProps","notifyCurrentKeyChanged","scrollListRef","updateCurrentKey","setContextMenuContext","setMenuProps","currentKeyRef","useContextMenuGesture","gesture","anchor","target","anchorBasedOnGesture","context","findItemContext","keyExtractor","handleCloseContextMenu","detail","reason","preventScroll","onClose","value","useListViewContextMenu","onPersistCurrentItem","reorderableItemRenderer","ReorderableContext","Provider","List","contextMenuTriggerProps","onLoadRange","id","HiddenAccessible","loadingIndicator","skeletonRenderer","SkeletonContainer","minimumCount","index","loadingStatus","loadMoreIndicator","LOADMORE_STYLE_CLASS","customLoadMoreSkeleton"],"mappings":"k2CAgEO,MAAMA,EAAiCC,EAAAA,MAlD9B,UAAmDC,SACjEA,EAAQC,QACR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EACnBE,mBAAoBA,EACpBD,OAAQoB,EAAMpB,OAASoB,EAAMpB,OAAS,aAAUgD,OAzD1B,IAC5B4D,CA4DA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
define(['exports', 'preact/jsx-runtime', 'preact/hooks', './mergeProps-bcfa6a92', './classNames-08d99695', './clientUtils-f1eea2db', './useId-c9578d26', './UNSAFE_NavigationList/themes/NavigationListStyles.css', './collectionUtils-77dc5fa1', './useCollectionFocusRing-ae19cd81', './useCurrentKey-5749e7fb', './useContextMenuGesture-750ef2c6', './useTranslationBundle-e4dd341e', './TabBarContextMenu-6a167e27', 'preact/compat', './useTestId-f4240cbd', './HiddenAccessible-037ef42d', './LiveRegion-dbefb95b', './UNSAFE_Text/themes/TextStyles.css', './NavigationListLinkItem-161049bb', './Flex-4b81b412', './logger-0f873e29', 'css!./BadgeStyles.styles.css', 'module', './UNSAFE_Badge/themes/redwood/BadgeVariants.css', 'preact', './LayerHost-0b288129', 'css!./TooltipContentStyles.styles.css', 'module', './hooks/UNSAFE_useTooltip/themes/redwood/TooltipContentVariants.css', './tooltipUtils-2bb62284', 'css!./IconStyle.styles.css', './UNSAFE_NavigationList/themes/NavigationListItemStyles.css', 'module', './UNSAFE_NavigationList/themes/redwood/NavigationListItemVariants.css', './BaseButton-5a0ad529', './ButtonLabelLayout-6464870c'], (function(e,t,n,o,s,r,i,a,c,l,u,d,m,y,f,g,b,v,x,h,p,C,S,K,N,I,R,F,L,k,B,E,M,w,A,T,U){"use strict";const _='[role="tab"]',j="[data-oj-navigationlist-item-remove-icon]",D={mouse:{initialFocus:"menu",placement:"bottom-start",offsetValue:0},keyboard:{initialFocus:"firstItem",placement:"bottom-start",offsetValue:0},touch:{initialFocus:"menu",placement:"end",offsetValue:40}},P={isOpen:!1,initialFocus:"menu",placement:"bottom-start",offsetValue:0,anchorRef:{current:null}};const V=(e,t,n)=>{const o=c.findElementByKey(t,e,_);if(o){return o.querySelector(n)}},H=(e,t)=>{const n=c.findElementByKey(t,e,_);if(n)return n.innerText},O=(e,t,n)=>{const o=e.closest(t),s=e.closest(n);return o?.contains(s)?null:c.keyExtractor(e,t)},q=(e,t,n)=>{const o=n.indexOf(e);if(o>0){const e=n[o===n.length-1?o-1:o+1];if(-1!==t.indexOf(e))return e}return t[0]},G=f.forwardRef((({children:e,selection:x,edge:p="start",onSelectionChange:C,onRemove:S,"aria-label":K,"aria-labelledby":N,testId:I,display:R="standard"},F)=>{const L=n.useRef(null),k=r.isMobile(),B=n.useMemo((()=>k?{itemsRenderer:e=>{if(e){if(null!=V(e.itemKey,L.current,j)){const n=e.defaultMenuItems;return t.jsx(t.Fragment,{children:n})}}return null}}:void 0),[k]),{showFocusRing:E,currentKey:M,onCurrentKeyChange:w,containerHandlers:A,onKeyDown:T,contextMenuContext:U,menuProps:G,contextMenuDescription:$,contextMenuDescriptionId:z,accStatusInfo:J}=function({containerRef:e,selection:t,onRemove:s,onSelectionChange:r,children:i,contextMenuConfig:a}){const f=m.useTranslationBundle("@oracle/oraclejet-preact"),[g,b]=n.useState(t),v=n.useCallback((e=>{b(e.value)}),[]),{currentKeyProps:x}=u.useCurrentKey((e=>s?O(e,_,j):c.keyExtractor(e,_)),!1,!1,c.getPrevNextKeyUsingRef(e,g,!0,_),c.getPrevNextKeyUsingRef(e,g,!1,_),void 0,void 0,g,v),[h,p]=l.useCollectionFocusRing(e,["Home","End","ArrowUp","ArrowDown"]),C={onFocus:n.useCallback((()=>{if(e.current&&void 0===g){const t=c.getFirstVisibleKey(e.current,_);t&&b(t)}}),[g,e])},S=n.useRef();n.useEffect((()=>{if(e.current){const t=Array.from(e.current.querySelectorAll(_),(e=>c.getKey(e)));if(null!=g&&-1!==t.indexOf(g)){const t=c.findElementByKey(e.current,g,_);t.scrollIntoViewIfNeeded?t.scrollIntoViewIfNeeded():t.scrollIntoView({block:"nearest"})}else g&&-1===t.indexOf(g)&&(S.current?b(q(g,t,S.current)):b(t[0])),S.current=t}}),[i,g,e]);const K=n.useCallback((t=>{if(("Home"===t.key||"End"===t.key)&&e.current&&g){const n=Array.from(e.current.querySelectorAll(_),(e=>c.getKey(e)));v?.({value:n["Home"===t.key?0:n.length-1]})}!g||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),r?.({value:g,reason:"keyboard"})),g&&"Delete"===t.key&&s?.({value:g})}),[g,r,s,v,e]),[N,I]=n.useState(),[R,F]=n.useState(P),[L,k]=n.useState(),{triggerProps:B}=d.useContextMenuGesture((({gesture:t,anchor:n,target:o})=>{let r=n,i=g;if("keyboard"===t){r=c.findElementByKey(e.current,g,_)||n}else{const e=c.keyExtractor(o,_);i=null!=e?e:g}let l=!1;e.current&&(l=null!=V(i,e.current,j));const u=y.getDefaultContextMenu({isRemovable:l,handleRemove:s,handleReorder:void 0,itemKey:i,tabKeys:void 0,direction:void 0,itemLabels:{labelRemove:l?f.tabbar_labelRemove():void 0},handleAccStatus:t=>{const n=H(t.removedKey,e.current),o=l&&t.removedKey?` Removed ${n}`:"";k(o)}});I(u),F({...D[t],anchorRef:{current:r},isOpen:null!=a})}),{isDisabled:!a}),E=n.useCallback((t=>{"dismissed"!==t.reason&&"itemAction"!==t.reason||(b(N?.itemKey),e.current?.focus()),F({...P})}),[e,N?.itemKey]),M="contextMenu_"+n.useId(),w=f.tabbar_labelContextMenu();return{showFocusRing:h,currentKey:g,onCurrentKeyChange:v,onKeyDown:K,menuProps:{...R,onClose:E},contextMenuContext:N,contextMenuDescription:w,contextMenuDescriptionId:M,accStatusInfo:L,containerHandlers:o.mergeProps(p,x,C,B)}}({containerRef:L,selection:x,onRemove:S,onSelectionChange:C,children:e,contextMenuConfig:B}),Q={onKeyDown:T},W=s.classNames([a.navigationListStyles.uListStyle]),X=i.useId()+"_",Y=g.useTestId(I);return f.useImperativeHandle(F,(()=>({focus:()=>{L.current&&L.current.focus()},blur:()=>{L.current&&L.current.focus()}}))),t.jsxs(t.Fragment,{children:[t.jsx("div",{"aria-label":K,"aria-labelledby":N,role:"tablist",ref:L,"aria-orientation":"vertical",tabIndex:0,"aria-activedescendant":M?X+M:"",...o.mergeProps(Q,A),...Y,class:W,children:t.jsx(h.NavigationListContext.Provider,{value:{selection:x,display:R,onSelectionChange:C,onCurrentKeyChange:w,currentKey:M,showFocusRing:E,navigationListItemPrefix:X,onRemove:S,edge:p},children:e})}),B&&z&&$&&t.jsx("span",{id:z,children:t.jsx(b.HiddenAccessible,{children:$})}),B&&J&&t.jsx(v.LiveRegion,{children:J}),B&&t.jsx(y.TabBarContextMenu,{...G,contextMenuConfig:B,contextMenuContext:U})]})}));e.NavigationList=G,e.NavigationListItem=function({itemKey:e,label:n,badge:o,metadata:s,severity:r,icon:i}){return t.jsx(h.BaseNavigationListItem,{itemKey:e,label:n,badge:o,metadata:s,severity:r,icon:i})}}));
|
|
2
|
+
//# sourceMappingURL=NavigationListItem-9df5446c.js.map
|