@semcore/d3-chart 16.2.0 → 16.3.0-prerelease.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/lib/cjs/Area.js +11 -11
- package/lib/cjs/Axis.js +92 -19
- package/lib/cjs/Axis.js.map +1 -1
- package/lib/cjs/Bar.js +16 -16
- package/lib/cjs/Bubble.js +13 -13
- package/lib/cjs/CompactHorizontalBar.js +16 -16
- package/lib/cjs/Donut.js +9 -9
- package/lib/cjs/Dots.js +8 -8
- package/lib/cjs/HorizontalBar.js +16 -16
- package/lib/cjs/Hover.js +3 -3
- package/lib/cjs/Line.js +9 -9
- package/lib/cjs/Plot.js +3 -3
- package/lib/cjs/Radar.js +19 -19
- package/lib/cjs/RadialTree.js +12 -12
- package/lib/cjs/Reference.js +12 -12
- package/lib/cjs/ScatterPlot.js +9 -9
- package/lib/cjs/Tooltip.js +9 -9
- package/lib/cjs/Venn.js +9 -9
- package/lib/cjs/a11y/PlotA11yModule.js +2 -2
- package/lib/cjs/a11y/PlotA11yView.js +2 -2
- package/lib/cjs/component/Chart/AbstractChart.js +11 -3
- package/lib/cjs/component/Chart/AbstractChart.js.map +1 -1
- package/lib/cjs/component/Chart/AbstractChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/BarChart.js +1 -1
- package/lib/cjs/component/Chart/BarChart.js.map +1 -1
- package/lib/cjs/component/Chart/HistogramChart.js +1 -1
- package/lib/cjs/component/Chart/HistogramChart.js.map +1 -1
- package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js +4 -4
- package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js +42 -24
- package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js.map +1 -1
- package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js +6 -6
- package/lib/cjs/style/axis.shadow.css +36 -0
- package/lib/cjs/types/Axis.d.js.map +1 -1
- package/lib/es6/Area.js +11 -11
- package/lib/es6/Axis.js +91 -19
- package/lib/es6/Axis.js.map +1 -1
- package/lib/es6/Bar.js +16 -16
- package/lib/es6/Bubble.js +13 -13
- package/lib/es6/CompactHorizontalBar.js +16 -16
- package/lib/es6/Donut.js +9 -9
- package/lib/es6/Dots.js +8 -8
- package/lib/es6/HorizontalBar.js +16 -16
- package/lib/es6/Hover.js +3 -3
- package/lib/es6/Line.js +9 -9
- package/lib/es6/Plot.js +3 -3
- package/lib/es6/Radar.js +19 -19
- package/lib/es6/RadialTree.js +12 -12
- package/lib/es6/Reference.js +12 -12
- package/lib/es6/ScatterPlot.js +9 -9
- package/lib/es6/Tooltip.js +9 -9
- package/lib/es6/Venn.js +9 -9
- package/lib/es6/a11y/PlotA11yModule.js +2 -2
- package/lib/es6/a11y/PlotA11yView.js +2 -2
- package/lib/es6/component/Chart/AbstractChart.js +11 -3
- package/lib/es6/component/Chart/AbstractChart.js.map +1 -1
- package/lib/es6/component/Chart/AbstractChart.type.js.map +1 -1
- package/lib/es6/component/Chart/BarChart.js +1 -1
- package/lib/es6/component/Chart/BarChart.js.map +1 -1
- package/lib/es6/component/Chart/HistogramChart.js +1 -1
- package/lib/es6/component/Chart/HistogramChart.js.map +1 -1
- package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js +4 -4
- package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js +42 -24
- package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js.map +1 -1
- package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js +6 -6
- package/lib/es6/style/axis.shadow.css +36 -0
- package/lib/es6/types/Axis.d.js.map +1 -1
- package/lib/esm/Area.mjs +12 -12
- package/lib/esm/Axis.mjs +86 -20
- package/lib/esm/Bar.mjs +17 -17
- package/lib/esm/Bubble.mjs +14 -14
- package/lib/esm/CompactHorizontalBar.mjs +17 -17
- package/lib/esm/Donut.mjs +10 -10
- package/lib/esm/Dots.mjs +9 -9
- package/lib/esm/HorizontalBar.mjs +17 -17
- package/lib/esm/Hover.mjs +4 -4
- package/lib/esm/Line.mjs +10 -10
- package/lib/esm/Plot.mjs +4 -4
- package/lib/esm/Radar.mjs +20 -20
- package/lib/esm/RadialTree.mjs +13 -13
- package/lib/esm/Reference.mjs +13 -13
- package/lib/esm/ScatterPlot.mjs +10 -10
- package/lib/esm/Tooltip.mjs +10 -10
- package/lib/esm/Venn.mjs +10 -10
- package/lib/esm/a11y/PlotA11yModule.mjs +3 -3
- package/lib/esm/a11y/PlotA11yView.mjs +3 -3
- package/lib/esm/component/Chart/AbstractChart.mjs +9 -3
- package/lib/esm/component/Chart/BarChart.mjs +1 -1
- package/lib/esm/component/Chart/HistogramChart.mjs +1 -1
- package/lib/esm/component/ChartLegend/LegendFlex/LegendFlex.mjs +5 -5
- package/lib/esm/component/ChartLegend/LegendItem/LegendItem.mjs +37 -25
- package/lib/esm/component/ChartLegend/LegendTable/LegendTable.mjs +7 -7
- package/lib/esm/style/axis.shadow.css +36 -0
- package/lib/types/Axis.d.ts +2 -0
- package/lib/types/component/Chart/AbstractChart.type.d.ts +4 -0
- package/package.json +18 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractChart.type.js","names":[],"sources":["../../../../src/component/Chart/AbstractChart.type.ts"],"sourcesContent":["import type { Intergalactic } from '@semcore/core';\nimport type { FlexProps } from '@semcore/flex-box';\nimport type Icon from '@semcore/icon';\nimport type React from 'react';\n\nimport type { PatternsConfig } from '../../Pattern';\n// @ts-ignore\nimport type { PlotSummarizerConfig } from '../../Plot';\nimport type { BaseChartLegendProps } from '../ChartLegend/BaseLegend.type';\nimport type { TrendProps } from '../ChartLegend/LegendFlex/LegendFlex.type';\nimport type { LegendItemKey } from '../ChartLegend/LegendItem/LegendItem.type';\n\nexport type BaseLegendProps = BaseChartLegendProps & {\n /**\n * Disable hover (for transition items legend of each not hovered)\n */\n disableHoverItems?: boolean;\n /**\n * Disable selectable of data items by checkboxes in Legend\n */\n disableSelectItems?: boolean;\n} & (\n | (TrendProps & {\n /**\n * How to render Legend - Flex view. Just list of legend items\n */\n legendType?: never | 'Flex';\n /**\n * Config for Legend items\n */\n legendMap?: LegendDataMap<'Flex'>;\n })\n | {\n /**\n * How to render Legend - Table view. Table of legend items with some additional information in columns\n */\n legendType: 'Table';\n /**\n * Config for Legend items\n */\n legendMap?: LegendDataMap<'Table'>;\n }\n );\n\nexport type ObjectData = Record<string, unknown>;\nexport type ListData = ObjectData[];\n\n/**\n * Chart, Legend must have an accessible names (aria-name).\n * It should describe chart or legend content.\n */\nexport type AriaNameProps = Intergalactic.RequireAtLeastOne<{\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'title'?: string;\n}>;\n\nexport type BaseChartProps<T extends ListData | ObjectData> = FlexProps &\n AriaNameProps & {\n /**\n * Chart data. For all charts except Donut(Pie), Radar and Venn should be an Array\n */\n data: T;\n /**\n * Width of plot\n */\n plotWidth: number;\n /**\n * Height of plot\n */\n plotHeight: number;\n\n /** Enables charts patterns that enhances charts accessibility */\n patterns?: PatternsConfig;\n /**\n * Margin (for Y axis points) from left side of chart container to Y axis\n */\n marginY?: number;\n /**\n * Margin (for X axis points) from bottom of chart container to X axis\n */\n marginX?: number;\n /**\n * invert axis and show horizontal charts (only for Bars!)\n */\n invertAxis?: boolean;\n\n /**\n * Show X axis\n * @default true (for charts with axis: Area, Line, Bar, ScatterPlot, ...)\n */\n showXAxis?: boolean;\n /**\n * Show Y axis\n * @default true (for charts with axis: Area, Line, Bar, ScatterPlot, ...)\n */\n showYAxis?: boolean;\n /**\n * Map with colors for data items\n */\n colorMap?: Record<string, string>;\n /**\n * Show tooltip's.\n * @default true\n */\n showTooltip?: boolean;\n /**\n * Show sum of values for selected point in tooltip\n */\n showTotalInTooltip?: boolean;\n /**\n * Scale for xAxis (see more in d3-scale)\n */\n xScale?: unknown;\n /**\n * Scale for yAxis (see more in d3-scale)\n */\n yScale?: unknown;\n /**\n * Count of ticks for X axis\n */\n xTicksCount?: number;\n /**\n * Count of ticks for Y axis\n */\n yTicksCount?: number;\n /**\n * Group key for all array-based charts (for get keys of items for legend except that group key)\n */\n groupKey?: string;\n /**\n * function for format axis item text\n */\n axisXValueFormatter?: (value: unknown) => string;\n axisYValueFormatter?: (value: unknown) => string;\n /**\n * Function for format text for tooltip\n */\n tooltipValueFormatter?: (value?: unknown) => string;\n /**\n * Config for a11y summary\n */\n a11yAltTextConfig?: PlotSummarizerConfig;\n\n /**\n * Animations duration, set 0 to disable animations\n */\n duration?: number;\n } /**\n * By default, we show the Legend for all charts with more the one data item.\n * For hide the Legend, you should set showLegend prop to `false`.\n */ & (\n | {\n /**\n * Don't show legend\n */\n showLegend?: false;\n legendProps?: never;\n }\n | {\n /**\n * By default (if showLegend don't set), for one data item on chart,\n * Legend component will be hide, and show for more then 1 data item.\n * If set `true` - Legend component will show always.\n */\n showLegend?: true;\n /**\n * Props for Legend\n */\n legendProps?: Partial<BaseLegendProps>;\n }\n );\n\ntype LegendDataMap<T extends 'Flex' | 'Table'> = Record<\n LegendItemKey,\n {\n /**\n * Custom label for legend item (by default use keys from data item object)\n */\n label?: string;\n /**\n * Additional text after label\n */\n additionalInfo?: string;\n /**\n * Count after label\n */\n count?: number;\n /**\n * Custom Icon\n */\n icon?: typeof Icon;\n /**\n * Flag for uncheck some items by default\n */\n defaultChecked?: boolean;\n } & (T extends 'Table' ? { columns?: React.ReactNode[] } : { columns?: never })\n>;\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"AbstractChart.type.js","names":[],"sources":["../../../../src/component/Chart/AbstractChart.type.ts"],"sourcesContent":["import type { Intergalactic } from '@semcore/core';\nimport type { FlexProps } from '@semcore/flex-box';\nimport type Icon from '@semcore/icon';\nimport type React from 'react';\n\nimport type { PatternsConfig } from '../../Pattern';\n// @ts-ignore\nimport type { PlotSummarizerConfig } from '../../Plot';\nimport type { BaseChartLegendProps } from '../ChartLegend/BaseLegend.type';\nimport type { TrendProps } from '../ChartLegend/LegendFlex/LegendFlex.type';\nimport type { LegendItemKey } from '../ChartLegend/LegendItem/LegendItem.type';\n\nexport type BaseLegendProps = BaseChartLegendProps & {\n /**\n * Disable hover (for transition items legend of each not hovered)\n */\n disableHoverItems?: boolean;\n /**\n * Disable selectable of data items by checkboxes in Legend\n */\n disableSelectItems?: boolean;\n} & (\n | (TrendProps & {\n /**\n * How to render Legend - Flex view. Just list of legend items\n */\n legendType?: never | 'Flex';\n /**\n * Config for Legend items\n */\n legendMap?: LegendDataMap<'Flex'>;\n })\n | {\n /**\n * How to render Legend - Table view. Table of legend items with some additional information in columns\n */\n legendType: 'Table';\n /**\n * Config for Legend items\n */\n legendMap?: LegendDataMap<'Table'>;\n }\n );\n\nexport type ObjectData = Record<string, unknown>;\nexport type ListData = ObjectData[];\n\n/**\n * Chart, Legend must have an accessible names (aria-name).\n * It should describe chart or legend content.\n */\nexport type AriaNameProps = Intergalactic.RequireAtLeastOne<{\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'title'?: string;\n}>;\n\nexport type BaseChartProps<T extends ListData | ObjectData> = FlexProps &\n AriaNameProps & {\n /**\n * Chart data. For all charts except Donut(Pie), Radar and Venn should be an Array\n */\n data: T;\n /**\n * Width of plot\n */\n plotWidth: number;\n /**\n * Height of plot\n */\n plotHeight: number;\n\n /** Enables charts patterns that enhances charts accessibility */\n patterns?: PatternsConfig;\n /**\n * Margin (for Y axis points) from left side of chart container to Y axis\n */\n marginY?: number;\n /**\n * Margin (for X axis points) from bottom of chart container to X axis\n */\n marginX?: number;\n /**\n * invert axis and show horizontal charts (only for Bars!)\n */\n invertAxis?: boolean;\n\n /**\n * Show X axis\n * @default true (for charts with axis: Area, Line, Bar, ScatterPlot, ...)\n */\n showXAxis?: boolean;\n /**\n * Show Y axis\n * @default true (for charts with axis: Area, Line, Bar, ScatterPlot, ...)\n */\n showYAxis?: boolean;\n /**\n * Map with colors for data items\n */\n colorMap?: Record<string, string>;\n /**\n * Show tooltip's.\n * @default true\n */\n showTooltip?: boolean;\n /**\n * Show sum of values for selected point in tooltip\n */\n showTotalInTooltip?: boolean;\n /**\n * Scale for xAxis (see more in d3-scale)\n */\n xScale?: unknown;\n /**\n * Scale for yAxis (see more in d3-scale)\n */\n yScale?: unknown;\n /**\n * Count of ticks for X axis\n */\n xTicksCount?: number;\n /**\n * Count of ticks for Y axis\n */\n yTicksCount?: number;\n /** Enables multiline tick labels for X axis, applicable only for band scales */\n multilineXTicks?: boolean;\n /** Enables multiline tick labels for Y axis, applicable only for band scales */\n multilineYTicks?: boolean;\n /**\n * Group key for all array-based charts (for get keys of items for legend except that group key)\n */\n groupKey?: string;\n /**\n * function for format axis item text\n */\n axisXValueFormatter?: (value: unknown) => string;\n axisYValueFormatter?: (value: unknown) => string;\n /**\n * Function for format text for tooltip\n */\n tooltipValueFormatter?: (value?: unknown) => string;\n /**\n * Config for a11y summary\n */\n a11yAltTextConfig?: PlotSummarizerConfig;\n\n /**\n * Animations duration, set 0 to disable animations\n */\n duration?: number;\n } /**\n * By default, we show the Legend for all charts with more the one data item.\n * For hide the Legend, you should set showLegend prop to `false`.\n */ & (\n | {\n /**\n * Don't show legend\n */\n showLegend?: false;\n legendProps?: never;\n }\n | {\n /**\n * By default (if showLegend don't set), for one data item on chart,\n * Legend component will be hide, and show for more then 1 data item.\n * If set `true` - Legend component will show always.\n */\n showLegend?: true;\n /**\n * Props for Legend\n */\n legendProps?: Partial<BaseLegendProps>;\n }\n );\n\ntype LegendDataMap<T extends 'Flex' | 'Table'> = Record<\n LegendItemKey,\n {\n /**\n * Custom label for legend item (by default use keys from data item object)\n */\n label?: string;\n /**\n * Additional text after label\n */\n additionalInfo?: string;\n /**\n * Count after label\n */\n count?: number;\n /**\n * Custom Icon\n */\n icon?: typeof Icon;\n /**\n * Flag for uncheck some items by default\n */\n defaultChecked?: boolean;\n } & (T extends 'Table' ? { columns?: React.ReactNode[] } : { columns?: never })\n>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -114,7 +114,7 @@ var BarChartComponent = /*#__PURE__*/function (_AbstractChart) {
|
|
|
114
114
|
if (dataDefinitions.length === 1) {
|
|
115
115
|
var item = dataDefinitions[0];
|
|
116
116
|
var BarComponent = invertAxis ? _.GroupBar.HorizontalBar : _.GroupBar.Bar;
|
|
117
|
-
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(BarComponent, {
|
|
117
|
+
return item.checked && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(BarComponent, {
|
|
118
118
|
x: invertAxis ? item.id : groupKey,
|
|
119
119
|
y: invertAxis ? groupKey : item.id,
|
|
120
120
|
key: item.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarChart.js","names":["_core","require","_i18nEnhance","_interopRequireDefault","_flexBox","_typography","_d3Scale","_react","_","_AbstractChart2","_intergalacticDynamicLocales","BarChartComponent","_AbstractChart","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","_callSuper2","concat","_defineProperty2","_data","e","barIndex","barKey","onClickBar","asProps","_inherits2","_createClass2","key","get","_this$asProps","xScale","invertAxis","valueScale","categoryScale","_this$asProps2","yScale","value","defaultLegendProps","props","trend","undefined","withTrend","renderTrend","_this$asProps3","groupKey","state","trendItem","createElement","Line","data","x","y","color","style","strokeWidth","strokeDasharray","Dots","display","renderChart","_this2","_this$asProps4","_this$asProps4$type","type","_this$state","dataDefinitions","highlightedLine","item","BarComponent","GroupBar","HorizontalBar","Bar","Fragment","id","onClick","handleClickBar","map","index","commonBarComponentProps","transparent","checked","_extends2","StackBar","renderTooltip","_this3","_this$asProps5","showTotalInTooltip","showTooltip","onClickHoverRect","HoverRect","Tooltip","wMin","_ref","_dataItem$groupKey","xIndex","yIndex","dataItem","total","totalValue","children","Title","toString","Flex","justifyContent","Dot","mr","label","Text","bold","tooltipValueFormatter","mt","Box","getLegendAriaLabel","getI18nText","chartType","_this$asProps6","_this$asProps6$margin","marginY","_this$asProps6$margin2","marginX","plotWidth","plotHeight","testItem","range","plotPadding","Date","Number","isNaN","getMilliseconds","domain","minMax","scaleTime","scaleBand","paddingInner","paddingOuter","_this$asProps7","_this$asProps7$margin","_this$asProps7$margin2","max","_superPropGet2","Math","apply","_toConsumableArray2","scaleLinear","AbstractChart","i18nEnhance","localizedMessages","BarChart","exports","createComponent"],"sources":["../../../../src/component/Chart/BarChart.tsx"],"sourcesContent":["import { createComponent } from '@semcore/core';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport { Box, Flex } from '@semcore/flex-box';\nimport { Text } from '@semcore/typography';\nimport { scaleBand, scaleLinear, scaleTime } from 'd3-scale';\nimport React from 'react';\n\nimport type { BaseLegendProps } from './AbstractChart.type';\nimport type { BarChartData, BarChartProps, BarChartType } from './BarChart.type';\n// @ts-ignore\nimport { minMax, GroupBar, HoverRect, StackBar, Line } from '../..';\nimport { AbstractChart } from './AbstractChart';\nimport { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';\nimport type { BarProps } from '../../types';\nimport type { LegendItemKey } from '../ChartLegend/LegendItem/LegendItem.type';\n\nclass BarChartComponent extends AbstractChart<\n BarChartData,\n BarChartProps,\n typeof BarChartComponent.enhance\n> {\n static displayName = 'Chart.Bar';\n\n static enhance = [i18nEnhance(localizedMessages)] as const;\n\n get xScale() {\n const { xScale, invertAxis } = this.asProps;\n\n if (xScale) {\n return xScale;\n }\n\n return invertAxis ? this.valueScale : this.categoryScale;\n }\n\n get yScale() {\n const { yScale, invertAxis } = this.asProps;\n\n if (yScale) {\n return yScale;\n }\n\n return invertAxis ? this.categoryScale : this.valueScale;\n }\n\n protected defaultLegendProps(): Partial<BaseLegendProps> {\n if (this.props.trend !== undefined) {\n return { withTrend: true };\n }\n\n return {};\n }\n\n renderTrend(key: LegendItemKey) {\n const { groupKey, invertAxis, trend } = this.asProps;\n const { withTrend } = this.state;\n const trendItem = trend?.[key];\n\n if (withTrend && trendItem) {\n return (\n <Line\n data={trendItem}\n key={`${key}_${groupKey}`}\n x={invertAxis ? 'y' : 'x'}\n y={invertAxis ? 'x' : 'y'}\n color='wall'\n style={{ strokeWidth: 3, strokeDasharray: 5 }}\n >\n <Line.Dots data={trendItem} display />\n </Line>\n );\n }\n\n return null;\n }\n\n renderChart() {\n const { groupKey, type = 'group', invertAxis } = this.asProps;\n const { dataDefinitions, highlightedLine } = this.state;\n\n if (dataDefinitions.length === 1) {\n const item = dataDefinitions[0];\n const BarComponent = invertAxis ? GroupBar.HorizontalBar : GroupBar.Bar;\n\n return (\n <>\n <BarComponent\n x={invertAxis ? item.id : groupKey}\n y={invertAxis ? groupKey : item.id}\n key={item.id}\n color={item.color}\n onClick={this.handleClickBar}\n />\n {this.renderTrend(item.id)}\n </>\n );\n }\n\n if (type === 'group') {\n return (\n <>\n <GroupBar x={invertAxis ? undefined : groupKey} y={invertAxis ? groupKey : undefined}>\n {dataDefinitions.map((item, index) => {\n const BarComponent = invertAxis ? GroupBar.HorizontalBar : GroupBar.Bar;\n\n const commonBarComponentProps: BarProps = {\n color: item.color,\n transparent: highlightedLine !== -1 && highlightedLine !== index,\n onClick: this.handleClickBar,\n };\n\n if (invertAxis) {\n commonBarComponentProps.x = item.id;\n } else {\n commonBarComponentProps.y = item.id;\n }\n\n return item.checked && <BarComponent key={item.id} {...commonBarComponentProps} />;\n })}\n </GroupBar>\n {dataDefinitions.map((item) => item.checked && this.renderTrend(item.id))}\n </>\n );\n }\n\n if (type === 'stack') {\n return (\n <>\n <StackBar x={invertAxis ? undefined : groupKey} y={invertAxis ? groupKey : undefined}>\n {dataDefinitions.map((item, index) => {\n const BarComponent = invertAxis ? StackBar.HorizontalBar : StackBar.Bar;\n\n const commonBarComponentProps: BarProps = {\n color: item.color,\n transparent: highlightedLine !== -1 && highlightedLine !== index,\n onClick: this.handleClickBar,\n };\n\n if (invertAxis) {\n commonBarComponentProps.x = item.id;\n } else {\n commonBarComponentProps.y = item.id;\n }\n\n return item.checked && <BarComponent key={item.id} {...commonBarComponentProps} />;\n })}\n </StackBar>\n {dataDefinitions.map((item) => item.checked && this.renderTrend(item.id))}\n </>\n );\n }\n\n return null;\n }\n\n renderTooltip(): React.ReactNode {\n const { data, groupKey, showTotalInTooltip, showTooltip, invertAxis, onClickHoverRect } =\n this.asProps;\n const { dataDefinitions } = this.state;\n\n if (!showTooltip) {\n return null;\n }\n\n return (\n <HoverRect.Tooltip\n x={invertAxis ? undefined : groupKey}\n y={invertAxis ? groupKey : undefined}\n wMin={100}\n onClick={onClickHoverRect}\n >\n {({ xIndex, yIndex }: any) => {\n const index = invertAxis ? yIndex : xIndex;\n const dataItem = data[index];\n const total = this.totalValue(dataItem);\n\n return {\n children: (\n <>\n <HoverRect.Tooltip.Title>{dataItem[groupKey]?.toString()}</HoverRect.Tooltip.Title>\n\n {dataDefinitions.map((item) => {\n return (\n item.checked && (\n <Flex justifyContent='space-between' key={item.id}>\n <HoverRect.Tooltip.Dot mr={4} color={item.color}>\n {item.label}\n </HoverRect.Tooltip.Dot>\n <Text bold>{this.tooltipValueFormatter(dataItem[item.id])}</Text>\n </Flex>\n )\n );\n })}\n\n {showTotalInTooltip === true && (\n <Flex mt={2} justifyContent='space-between'>\n <Box mr={4}>Total</Box>\n <Text bold>{total}</Text>\n </Flex>\n )}\n </>\n ),\n };\n }}\n </HoverRect.Tooltip>\n );\n }\n\n protected getLegendAriaLabel(): string {\n return this.asProps.getI18nText('legendForChart', { chartType: 'Bar' });\n }\n\n private handleClickBar = (\n _data: BarChartData[0],\n e: React.SyntheticEvent,\n barIndex: number,\n barKey: string,\n ) => {\n const { onClickBar } = this.asProps;\n\n if (onClickBar) {\n onClickBar(barIndex, barKey, e);\n }\n };\n\n private get categoryScale() {\n const {\n marginY = 40,\n marginX = 24,\n plotWidth,\n plotHeight,\n invertAxis,\n data,\n groupKey,\n } = this.asProps;\n\n const testItem = data[0][groupKey];\n const range = invertAxis\n ? [plotHeight - marginX, this.plotPadding]\n : [marginY, plotWidth - this.plotPadding];\n\n if (testItem instanceof Date && !Number.isNaN(testItem.getMilliseconds())) {\n const domain = minMax(data, groupKey);\n\n return scaleTime(domain, range);\n }\n\n const domain = data.map((item) => item[groupKey]);\n\n return scaleBand(domain, range).paddingInner(0.4).paddingOuter(0.2);\n }\n\n private get valueScale() {\n const { marginY = 40, marginX = 24, plotWidth, plotHeight, invertAxis, type } = this.asProps;\n\n const max = type === 'stack' ? super.maxStackedValue : Math.max(...super.flatValues);\n\n return scaleLinear()\n .range(\n invertAxis\n ? [marginY, plotWidth - this.plotPadding]\n : [plotHeight - marginX, this.plotPadding],\n )\n .domain([0, max]);\n }\n}\n\nexport const BarChart: BarChartType = createComponent(BarChartComponent);\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAKA,IAAAO,CAAA,GAAAP,OAAA;AACA,IAAAQ,eAAA,GAAAR,OAAA;AACA,IAAAS,4BAAA,GAAAT,OAAA;AAHA;AAAA,IAOMU,iBAAiB,0BAAAC,cAAA;EAAA,SAAAD,kBAAA;IAAA,IAAAE,KAAA;IAAA,IAAAC,gBAAA,mBAAAH,iBAAA;IAAA,SAAAI,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAAAF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;IAAA;IAAAP,KAAA,OAAAQ,WAAA,mBAAAV,iBAAA,KAAAW,MAAA,CAAAJ,IAAA;IAAA,IAAAK,gBAAA,aAAAV,KAAA,oBAoMI,UACvBW,KAAsB,EACtBC,CAAuB,EACvBC,QAAgB,EAChBC,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GAAGF,OAAO,EAAE,IAAI,CAACK,WAAW,CAC7C,CAAC,CACAK,MAAM,CAAC,CAAC,CAAC,EAAES,GAAG,CAAC,CAAC;IACrB;EAAC;AAAA,EAxP6BM,6BAAa;AAAA,IAAA7H,gBAAA,aAAvCZ,iBAAiB,iBAKA,WAAW;AAAA,IAAAY,gBAAA,aAL5BZ,iBAAiB,aAOJ,CAAC,IAAA0I,uBAAW,EAACC,8CAAiB,CAAC,CAAC;AAoP5C,IAAMC,QAAsB,GAAAC,OAAA,CAAAD,QAAA,GAAG,IAAAE,qBAAe,EAAC9I,iBAAiB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"BarChart.js","names":["_core","require","_i18nEnhance","_interopRequireDefault","_flexBox","_typography","_d3Scale","_react","_","_AbstractChart2","_intergalacticDynamicLocales","BarChartComponent","_AbstractChart","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","_callSuper2","concat","_defineProperty2","_data","e","barIndex","barKey","onClickBar","asProps","_inherits2","_createClass2","key","get","_this$asProps","xScale","invertAxis","valueScale","categoryScale","_this$asProps2","yScale","value","defaultLegendProps","props","trend","undefined","withTrend","renderTrend","_this$asProps3","groupKey","state","trendItem","createElement","Line","data","x","y","color","style","strokeWidth","strokeDasharray","Dots","display","renderChart","_this2","_this$asProps4","_this$asProps4$type","type","_this$state","dataDefinitions","highlightedLine","item","BarComponent","GroupBar","HorizontalBar","Bar","checked","Fragment","id","onClick","handleClickBar","map","index","commonBarComponentProps","transparent","_extends2","StackBar","renderTooltip","_this3","_this$asProps5","showTotalInTooltip","showTooltip","onClickHoverRect","HoverRect","Tooltip","wMin","_ref","_dataItem$groupKey","xIndex","yIndex","dataItem","total","totalValue","children","Title","toString","Flex","justifyContent","Dot","mr","label","Text","bold","tooltipValueFormatter","mt","Box","getLegendAriaLabel","getI18nText","chartType","_this$asProps6","_this$asProps6$margin","marginY","_this$asProps6$margin2","marginX","plotWidth","plotHeight","testItem","range","plotPadding","Date","Number","isNaN","getMilliseconds","domain","minMax","scaleTime","scaleBand","paddingInner","paddingOuter","_this$asProps7","_this$asProps7$margin","_this$asProps7$margin2","max","_superPropGet2","Math","apply","_toConsumableArray2","scaleLinear","AbstractChart","i18nEnhance","localizedMessages","BarChart","exports","createComponent"],"sources":["../../../../src/component/Chart/BarChart.tsx"],"sourcesContent":["import { createComponent } from '@semcore/core';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport { Box, Flex } from '@semcore/flex-box';\nimport { Text } from '@semcore/typography';\nimport { scaleBand, scaleLinear, scaleTime } from 'd3-scale';\nimport React from 'react';\n\nimport type { BaseLegendProps } from './AbstractChart.type';\nimport type { BarChartData, BarChartProps, BarChartType } from './BarChart.type';\n// @ts-ignore\nimport { minMax, GroupBar, HoverRect, StackBar, Line } from '../..';\nimport { AbstractChart } from './AbstractChart';\nimport { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';\nimport type { BarProps } from '../../types';\nimport type { LegendItemKey } from '../ChartLegend/LegendItem/LegendItem.type';\n\nclass BarChartComponent extends AbstractChart<\n BarChartData,\n BarChartProps,\n typeof BarChartComponent.enhance\n> {\n static displayName = 'Chart.Bar';\n\n static enhance = [i18nEnhance(localizedMessages)] as const;\n\n get xScale() {\n const { xScale, invertAxis } = this.asProps;\n\n if (xScale) {\n return xScale;\n }\n\n return invertAxis ? this.valueScale : this.categoryScale;\n }\n\n get yScale() {\n const { yScale, invertAxis } = this.asProps;\n\n if (yScale) {\n return yScale;\n }\n\n return invertAxis ? this.categoryScale : this.valueScale;\n }\n\n protected defaultLegendProps(): Partial<BaseLegendProps> {\n if (this.props.trend !== undefined) {\n return { withTrend: true };\n }\n\n return {};\n }\n\n renderTrend(key: LegendItemKey) {\n const { groupKey, invertAxis, trend } = this.asProps;\n const { withTrend } = this.state;\n const trendItem = trend?.[key];\n\n if (withTrend && trendItem) {\n return (\n <Line\n data={trendItem}\n key={`${key}_${groupKey}`}\n x={invertAxis ? 'y' : 'x'}\n y={invertAxis ? 'x' : 'y'}\n color='wall'\n style={{ strokeWidth: 3, strokeDasharray: 5 }}\n >\n <Line.Dots data={trendItem} display />\n </Line>\n );\n }\n\n return null;\n }\n\n renderChart() {\n const { groupKey, type = 'group', invertAxis } = this.asProps;\n const { dataDefinitions, highlightedLine } = this.state;\n\n if (dataDefinitions.length === 1) {\n const item = dataDefinitions[0];\n const BarComponent = invertAxis ? GroupBar.HorizontalBar : GroupBar.Bar;\n\n return (\n item.checked && (\n <>\n <BarComponent\n x={invertAxis ? item.id : groupKey}\n y={invertAxis ? groupKey : item.id}\n key={item.id}\n color={item.color}\n onClick={this.handleClickBar}\n />\n {this.renderTrend(item.id)}\n </>\n )\n );\n }\n\n if (type === 'group') {\n return (\n <>\n <GroupBar x={invertAxis ? undefined : groupKey} y={invertAxis ? groupKey : undefined}>\n {dataDefinitions.map((item, index) => {\n const BarComponent = invertAxis ? GroupBar.HorizontalBar : GroupBar.Bar;\n\n const commonBarComponentProps: BarProps = {\n color: item.color,\n transparent: highlightedLine !== -1 && highlightedLine !== index,\n onClick: this.handleClickBar,\n };\n\n if (invertAxis) {\n commonBarComponentProps.x = item.id;\n } else {\n commonBarComponentProps.y = item.id;\n }\n\n return item.checked && <BarComponent key={item.id} {...commonBarComponentProps} />;\n })}\n </GroupBar>\n {dataDefinitions.map((item) => item.checked && this.renderTrend(item.id))}\n </>\n );\n }\n\n if (type === 'stack') {\n return (\n <>\n <StackBar x={invertAxis ? undefined : groupKey} y={invertAxis ? groupKey : undefined}>\n {dataDefinitions.map((item, index) => {\n const BarComponent = invertAxis ? StackBar.HorizontalBar : StackBar.Bar;\n\n const commonBarComponentProps: BarProps = {\n color: item.color,\n transparent: highlightedLine !== -1 && highlightedLine !== index,\n onClick: this.handleClickBar,\n };\n\n if (invertAxis) {\n commonBarComponentProps.x = item.id;\n } else {\n commonBarComponentProps.y = item.id;\n }\n\n return item.checked && <BarComponent key={item.id} {...commonBarComponentProps} />;\n })}\n </StackBar>\n {dataDefinitions.map((item) => item.checked && this.renderTrend(item.id))}\n </>\n );\n }\n\n return null;\n }\n\n renderTooltip(): React.ReactNode {\n const { data, groupKey, showTotalInTooltip, showTooltip, invertAxis, onClickHoverRect } =\n this.asProps;\n const { dataDefinitions } = this.state;\n\n if (!showTooltip) {\n return null;\n }\n\n return (\n <HoverRect.Tooltip\n x={invertAxis ? undefined : groupKey}\n y={invertAxis ? groupKey : undefined}\n wMin={100}\n onClick={onClickHoverRect}\n >\n {({ xIndex, yIndex }: any) => {\n const index = invertAxis ? yIndex : xIndex;\n const dataItem = data[index];\n const total = this.totalValue(dataItem);\n\n return {\n children: (\n <>\n <HoverRect.Tooltip.Title>{dataItem[groupKey]?.toString()}</HoverRect.Tooltip.Title>\n\n {dataDefinitions.map((item) => {\n return (\n item.checked && (\n <Flex justifyContent='space-between' key={item.id}>\n <HoverRect.Tooltip.Dot mr={4} color={item.color}>\n {item.label}\n </HoverRect.Tooltip.Dot>\n <Text bold>{this.tooltipValueFormatter(dataItem[item.id])}</Text>\n </Flex>\n )\n );\n })}\n\n {showTotalInTooltip === true && (\n <Flex mt={2} justifyContent='space-between'>\n <Box mr={4}>Total</Box>\n <Text bold>{total}</Text>\n </Flex>\n )}\n </>\n ),\n };\n }}\n </HoverRect.Tooltip>\n );\n }\n\n protected getLegendAriaLabel(): string {\n return this.asProps.getI18nText('legendForChart', { chartType: 'Bar' });\n }\n\n private handleClickBar = (\n _data: BarChartData[0],\n e: React.SyntheticEvent,\n barIndex: number,\n barKey: string,\n ) => {\n const { onClickBar } = this.asProps;\n\n if (onClickBar) {\n onClickBar(barIndex, barKey, e);\n }\n };\n\n private get categoryScale() {\n const {\n marginY = 40,\n marginX = 24,\n plotWidth,\n plotHeight,\n invertAxis,\n data,\n groupKey,\n } = this.asProps;\n\n const testItem = data[0][groupKey];\n const range = invertAxis\n ? [plotHeight - marginX, this.plotPadding]\n : [marginY, plotWidth - this.plotPadding];\n\n if (testItem instanceof Date && !Number.isNaN(testItem.getMilliseconds())) {\n const domain = minMax(data, groupKey);\n\n return scaleTime(domain, range);\n }\n\n const domain = data.map((item) => item[groupKey]);\n\n return scaleBand(domain, range).paddingInner(0.4).paddingOuter(0.2);\n }\n\n private get valueScale() {\n const { marginY = 40, marginX = 24, plotWidth, plotHeight, invertAxis, type } = this.asProps;\n\n const max = type === 'stack' ? super.maxStackedValue : Math.max(...super.flatValues);\n\n return scaleLinear()\n .range(\n invertAxis\n ? [marginY, plotWidth - this.plotPadding]\n : [plotHeight - marginX, this.plotPadding],\n )\n .domain([0, max]);\n }\n}\n\nexport const BarChart: BarChartType = createComponent(BarChartComponent);\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAKA,IAAAO,CAAA,GAAAP,OAAA;AACA,IAAAQ,eAAA,GAAAR,OAAA;AACA,IAAAS,4BAAA,GAAAT,OAAA;AAHA;AAAA,IAOMU,iBAAiB,0BAAAC,cAAA;EAAA,SAAAD,kBAAA;IAAA,IAAAE,KAAA;IAAA,IAAAC,gBAAA,mBAAAH,iBAAA;IAAA,SAAAI,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAAAF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;IAAA;IAAAP,KAAA,OAAAQ,WAAA,mBAAAV,iBAAA,KAAAW,MAAA,CAAAJ,IAAA;IAAA,IAAAK,gBAAA,aAAAV,KAAA,oBAsMI,UACvBW,KAAsB,EACtBC,CAAuB,EACvBC,QAAgB,EAChBC,MAAc,EACX;MACH,IAAQC,UA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AACH,UAAU,GAAGF,OAAO,EAAE,IAAI,CAACK,WAAW,CAC7C,CAAC,CACAK,MAAM,CAAC,CAAC,CAAC,EAAES,GAAG,CAAC,CAAC;IACrB;EAAC;AAAA,EA1P6BM,6BAAa;AAAA,IAAA7H,gBAAA,aAAvCZ,iBAAiB,iBAKA,WAAW;AAAA,IAAAY,gBAAA,aAL5BZ,iBAAiB,aAOJ,CAAC,IAAA0I,uBAAW,EAACC,8CAAiB,CAAC,CAAC;AAsP5C,IAAMC,QAAsB,GAAAC,OAAA,CAAAD,QAAA,GAAG,IAAAE,qBAAe,EAAC9I,iBAAiB,CAAC","ignoreList":[]}
|
|
@@ -126,7 +126,7 @@ var HistogramChartComponent = /*#__PURE__*/function (_AbstractChart) {
|
|
|
126
126
|
}));
|
|
127
127
|
}
|
|
128
128
|
var item = dataDefinitions[0];
|
|
129
|
-
return /*#__PURE__*/_react["default"].createElement(_.Bar, {
|
|
129
|
+
return item.checked && /*#__PURE__*/_react["default"].createElement(_.Bar, {
|
|
130
130
|
x: invertAxis ? item.id : groupKey,
|
|
131
131
|
y: invertAxis ? groupKey : item.id,
|
|
132
132
|
key: item.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HistogramChart.js","names":["_core","require","_i18nEnhance","_interopRequireDefault","_flexBox","_typography","_d3Scale","_react","_","_AbstractChart2","_intergalacticDynamicLocales","HistogramChartComponent","_AbstractChart","_classCallCheck2","_callSuper2","arguments","_inherits2","_createClass2","key","get","_this$asProps","asProps","xScale","_this$asProps$marginY","marginY","_this$asProps$marginX","marginX","plotWidth","plotHeight","invertAxis","data","groupKey","testItem","range","plotPadding","Date","Number","isNaN","getMilliseconds","domain","minMax","scaleTime","map","item","scaleBand","paddingInner","paddingOuter","_this$asProps2","yScale","_this$asProps2$margin","_this$asProps2$margin2","max","isStack","reduce","barSum","Object","values","sum","val","flatValues","_superPropGet2","Math","apply","_toConsumableArray2","scaleLinear","dataDefinitions","state","length","value","renderChart","_this$asProps3","_this$state","highlightedLine","createElement","StackBar","x","undefined","y","index","BarComponent","HorizontalBar","Bar","commonBarComponentProps","color","transparent","id","checked","_extends2","renderTooltip","_this","_this$asProps4","showTotalInTooltip","showTooltip","HoverRect","Tooltip","wMin","_ref","_dataItem$groupKey","xIndex","yIndex","dataItem","total","totalValue","children","Fragment","Title","toString","Flex","justifyContent","Dot","mr","label","Text","bold","tooltipValueFormatter","mt","Box","getLegendAriaLabel","getI18nText","chartType","AbstractChart","_defineProperty2","i18nEnhance","localizedMessages","HistogramChart","exports","createComponent"],"sources":["../../../../src/component/Chart/HistogramChart.tsx"],"sourcesContent":["import { createComponent } from '@semcore/core';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport { Box, Flex } from '@semcore/flex-box';\nimport { Text } from '@semcore/typography';\nimport { scaleBand, scaleLinear, type ScaleLinear, scaleTime } from 'd3-scale';\nimport React from 'react';\n\n// @ts-ignore\nimport { Bar, minMax, HoverRect, StackBar, type BarProps } from '../..';\nimport { AbstractChart } from './AbstractChart';\nimport type { HistogramChartData, HistogramChartProps, HistogramChartType } from './HistogramChart.type';\nimport { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';\n\nclass HistogramChartComponent extends AbstractChart<\n HistogramChartData,\n HistogramChartProps,\n typeof HistogramChartComponent.enhance\n> {\n static displayName = 'Chart.Histogram';\n\n static enhance = [i18nEnhance(localizedMessages)] as const;\n\n get xScale() {\n const {\n xScale,\n marginY = 30,\n marginX = 30,\n plotWidth,\n plotHeight,\n invertAxis,\n data,\n groupKey,\n } = this.asProps;\n\n if (xScale) {\n return xScale;\n }\n\n const testItem = data[0][groupKey];\n const range = invertAxis\n ? [plotHeight - marginX, this.plotPadding]\n : [marginY, plotWidth - this.plotPadding];\n\n if (testItem instanceof Date && !Number.isNaN(testItem.getMilliseconds())) {\n const domain = minMax(data, groupKey);\n\n return scaleTime(domain, range);\n }\n\n const domain = data.map((item) => item[groupKey]);\n\n return scaleBand(domain, range).paddingInner(0.05).paddingOuter(0.2);\n }\n\n get yScale(): ScaleLinear<any, any> {\n const {\n yScale,\n marginY = 30,\n marginX = 30,\n plotHeight,\n plotWidth,\n invertAxis,\n data,\n } = this.asProps;\n\n let max: number;\n\n if (this.isStack) {\n max = data.reduce((max, item) => {\n const barSum = Object.values(item).reduce<number>((sum, val) => {\n if (val instanceof Date && !Number.isNaN(val.getMilliseconds())) {\n return sum + val.getMilliseconds();\n }\n\n return sum + (val as number);\n }, 0);\n\n if (barSum > max) {\n max = barSum;\n }\n\n return max;\n }, 0);\n } else {\n const flatValues = super.flatValues;\n\n max = Math.max(...flatValues);\n }\n\n return (\n yScale ??\n scaleLinear()\n .range(\n invertAxis\n ? [marginY, plotWidth - this.plotPadding]\n : [plotHeight - marginX, this.plotPadding],\n )\n .domain([0, max])\n );\n }\n\n get isStack(): boolean {\n const { dataDefinitions } = this.state;\n\n return dataDefinitions.length > 1;\n }\n\n renderChart() {\n const { groupKey, invertAxis } = this.asProps;\n const { dataDefinitions, highlightedLine } = this.state;\n\n if (this.isStack) {\n return (\n <StackBar x={invertAxis ? undefined : groupKey} y={invertAxis ? groupKey : undefined}>\n {dataDefinitions.map((item, index) => {\n const BarComponent = invertAxis ? StackBar.HorizontalBar : StackBar.Bar;\n\n const commonBarComponentProps: BarProps = {\n color: item.color,\n transparent: highlightedLine !== -1 && highlightedLine !== index,\n };\n\n if (invertAxis) {\n commonBarComponentProps.x = item.id;\n } else {\n commonBarComponentProps.y = item.id;\n }\n\n return item.checked && <BarComponent key={item.id} {...commonBarComponentProps} />;\n })}\n </StackBar>\n );\n }\n\n const item = dataDefinitions[0];\n\n return (\n <Bar\n x={invertAxis ? item.id : groupKey}\n y={invertAxis ? groupKey : item.id}\n key={item.id}\n color={item.color}\n />\n );\n }\n\n renderTooltip(): React.ReactNode {\n const { data, groupKey, showTotalInTooltip, showTooltip, invertAxis } = this.asProps;\n const { dataDefinitions } = this.state;\n\n if (!showTooltip) {\n return null;\n }\n\n return (\n <HoverRect.Tooltip\n x={invertAxis ? undefined : groupKey}\n y={invertAxis ? groupKey : undefined}\n wMin={100}\n >\n {({ xIndex, yIndex }: any) => {\n const index = invertAxis ? yIndex : xIndex;\n const dataItem = data[index];\n const total = this.totalValue(dataItem);\n\n return {\n children: (\n <>\n <HoverRect.Tooltip.Title>{dataItem[groupKey]?.toString()}</HoverRect.Tooltip.Title>\n\n {dataDefinitions.map((item) => {\n return (\n item.checked && (\n <Flex justifyContent='space-between' key={item.id}>\n <HoverRect.Tooltip.Dot mr={4} color={item.color}>\n {item.label}\n </HoverRect.Tooltip.Dot>\n <Text bold>{this.tooltipValueFormatter(dataItem[item.id])}</Text>\n </Flex>\n )\n );\n })}\n\n {showTotalInTooltip === true && (\n <Flex mt={2} justifyContent='space-between'>\n <Box mr={4}>Total</Box>\n <Text bold>{total}</Text>\n </Flex>\n )}\n </>\n ),\n };\n }}\n </HoverRect.Tooltip>\n );\n }\n\n protected getLegendAriaLabel(): string {\n return this.asProps.getI18nText('legendForChart', { chartType: 'Histogram' });\n }\n}\n\nexport const HistogramChart: HistogramChartType = createComponent(HistogramChartComponent);\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAGA,IAAAO,CAAA,GAAAP,OAAA;AACA,IAAAQ,eAAA,GAAAR,OAAA;AAEA,IAAAS,4BAAA,GAAAT,OAAA;AAJA;AAAA,IAMMU,uBAAuB,0BAAAC,cAAA;EAAA,SAAAD,wBAAA;IAAA,IAAAE,gBAAA,mBAAAF,uBAAA;IAAA,WAAAG,WAAA,mBAAAH,uBAAA,EAAAI,SAAA;EAAA;EAAA,IAAAC,UAAA,aAAAL,uBAAA,E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,CAAAqF,SAAS,CAACC,OAAO,CAACe,GAAG;cAACC,EAAE,EAAE,CAAE;cAAC3B,KAAK,EAAExC,IAAI,CAACwC;YAAM,GAC7CxC,IAAI,CAACoE,KACe,CAAC,eACxBxG,MAAA,YAAAkE,aAAA,CAACpE,WAAA,CAAA2G,IAAI;cAACC,IAAI;YAAA,GAAExB,KAAI,CAACyB,qBAAqB,CAACd,QAAQ,CAACzD,IAAI,CAAC0C,EAAE,CAAC,CAAQ,CAC5D,CACP;UAEL,CAAC,CAAC,EAEDM,kBAAkB,KAAK,IAAI,iBAC1BpF,MAAA,YAAAkE,aAAA,CAACrE,QAAA,CAAAuG,IAAI;YAACQ,EAAE,EAAE,CAAE;YAACP,cAAc,EAAC;UAAe,gBACzCrG,MAAA,YAAAkE,aAAA,CAACrE,QAAA,CAAAgH,GAAG;YAACN,EAAE,EAAE;UAAE,GAAC,OAAU,CAAC,eACvBvG,MAAA,YAAAkE,aAAA,CAACpE,WAAA,CAAA2G,IAAI;YAACC,IAAI;UAAA,GAAEZ,KAAY,CACpB,CAER;QAEN,CAAC;MACH,CACiB,CAAC;IAExB;EAAC;IAAAnF,GAAA;IAAAkD,KAAA,EAED,SAAUiD,kBAAkBA,CAAA,EAAW;MACrC,OAAO,IAAI,CAAChG,OAAO,CAACiG,WAAW,CAAC,gBAAgB,EAAE;QAAEC,SAAS,EAAE;MAAY,CAAC,CAAC;IAC/E;EAAC;AAAA,EA1LmCC,6BAAa;AAAA,IAAAC,gBAAA,aAA7C9G,uBAAuB,iBAKN,iBAAiB;AAAA,IAAA8G,gBAAA,aALlC9G,uBAAuB,aAOV,CAAC,IAAA+G,uBAAW,EAACC,8CAAiB,CAAC,CAAC;AAsL5C,IAAMC,cAAkC,GAAAC,OAAA,CAAAD,cAAA,GAAG,IAAAE,qBAAe,EAACnH,uBAAuB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"HistogramChart.js","names":["_core","require","_i18nEnhance","_interopRequireDefault","_flexBox","_typography","_d3Scale","_react","_","_AbstractChart2","_intergalacticDynamicLocales","HistogramChartComponent","_AbstractChart","_classCallCheck2","_callSuper2","arguments","_inherits2","_createClass2","key","get","_this$asProps","asProps","xScale","_this$asProps$marginY","marginY","_this$asProps$marginX","marginX","plotWidth","plotHeight","invertAxis","data","groupKey","testItem","range","plotPadding","Date","Number","isNaN","getMilliseconds","domain","minMax","scaleTime","map","item","scaleBand","paddingInner","paddingOuter","_this$asProps2","yScale","_this$asProps2$margin","_this$asProps2$margin2","max","isStack","reduce","barSum","Object","values","sum","val","flatValues","_superPropGet2","Math","apply","_toConsumableArray2","scaleLinear","dataDefinitions","state","length","value","renderChart","_this$asProps3","_this$state","highlightedLine","createElement","StackBar","x","undefined","y","index","BarComponent","HorizontalBar","Bar","commonBarComponentProps","color","transparent","id","checked","_extends2","renderTooltip","_this","_this$asProps4","showTotalInTooltip","showTooltip","HoverRect","Tooltip","wMin","_ref","_dataItem$groupKey","xIndex","yIndex","dataItem","total","totalValue","children","Fragment","Title","toString","Flex","justifyContent","Dot","mr","label","Text","bold","tooltipValueFormatter","mt","Box","getLegendAriaLabel","getI18nText","chartType","AbstractChart","_defineProperty2","i18nEnhance","localizedMessages","HistogramChart","exports","createComponent"],"sources":["../../../../src/component/Chart/HistogramChart.tsx"],"sourcesContent":["import { createComponent } from '@semcore/core';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport { Box, Flex } from '@semcore/flex-box';\nimport { Text } from '@semcore/typography';\nimport { scaleBand, scaleLinear, type ScaleLinear, scaleTime } from 'd3-scale';\nimport React from 'react';\n\n// @ts-ignore\nimport { Bar, minMax, HoverRect, StackBar, type BarProps } from '../..';\nimport { AbstractChart } from './AbstractChart';\nimport type { HistogramChartData, HistogramChartProps, HistogramChartType } from './HistogramChart.type';\nimport { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';\n\nclass HistogramChartComponent extends AbstractChart<\n HistogramChartData,\n HistogramChartProps,\n typeof HistogramChartComponent.enhance\n> {\n static displayName = 'Chart.Histogram';\n\n static enhance = [i18nEnhance(localizedMessages)] as const;\n\n get xScale() {\n const {\n xScale,\n marginY = 30,\n marginX = 30,\n plotWidth,\n plotHeight,\n invertAxis,\n data,\n groupKey,\n } = this.asProps;\n\n if (xScale) {\n return xScale;\n }\n\n const testItem = data[0][groupKey];\n const range = invertAxis\n ? [plotHeight - marginX, this.plotPadding]\n : [marginY, plotWidth - this.plotPadding];\n\n if (testItem instanceof Date && !Number.isNaN(testItem.getMilliseconds())) {\n const domain = minMax(data, groupKey);\n\n return scaleTime(domain, range);\n }\n\n const domain = data.map((item) => item[groupKey]);\n\n return scaleBand(domain, range).paddingInner(0.05).paddingOuter(0.2);\n }\n\n get yScale(): ScaleLinear<any, any> {\n const {\n yScale,\n marginY = 30,\n marginX = 30,\n plotHeight,\n plotWidth,\n invertAxis,\n data,\n } = this.asProps;\n\n let max: number;\n\n if (this.isStack) {\n max = data.reduce((max, item) => {\n const barSum = Object.values(item).reduce<number>((sum, val) => {\n if (val instanceof Date && !Number.isNaN(val.getMilliseconds())) {\n return sum + val.getMilliseconds();\n }\n\n return sum + (val as number);\n }, 0);\n\n if (barSum > max) {\n max = barSum;\n }\n\n return max;\n }, 0);\n } else {\n const flatValues = super.flatValues;\n\n max = Math.max(...flatValues);\n }\n\n return (\n yScale ??\n scaleLinear()\n .range(\n invertAxis\n ? [marginY, plotWidth - this.plotPadding]\n : [plotHeight - marginX, this.plotPadding],\n )\n .domain([0, max])\n );\n }\n\n get isStack(): boolean {\n const { dataDefinitions } = this.state;\n\n return dataDefinitions.length > 1;\n }\n\n renderChart() {\n const { groupKey, invertAxis } = this.asProps;\n const { dataDefinitions, highlightedLine } = this.state;\n\n if (this.isStack) {\n return (\n <StackBar x={invertAxis ? undefined : groupKey} y={invertAxis ? groupKey : undefined}>\n {dataDefinitions.map((item, index) => {\n const BarComponent = invertAxis ? StackBar.HorizontalBar : StackBar.Bar;\n\n const commonBarComponentProps: BarProps = {\n color: item.color,\n transparent: highlightedLine !== -1 && highlightedLine !== index,\n };\n\n if (invertAxis) {\n commonBarComponentProps.x = item.id;\n } else {\n commonBarComponentProps.y = item.id;\n }\n\n return item.checked && <BarComponent key={item.id} {...commonBarComponentProps} />;\n })}\n </StackBar>\n );\n }\n\n const item = dataDefinitions[0];\n\n return (\n item.checked && (\n <Bar\n x={invertAxis ? item.id : groupKey}\n y={invertAxis ? groupKey : item.id}\n key={item.id}\n color={item.color}\n />\n )\n );\n }\n\n renderTooltip(): React.ReactNode {\n const { data, groupKey, showTotalInTooltip, showTooltip, invertAxis } = this.asProps;\n const { dataDefinitions } = this.state;\n\n if (!showTooltip) {\n return null;\n }\n\n return (\n <HoverRect.Tooltip\n x={invertAxis ? undefined : groupKey}\n y={invertAxis ? groupKey : undefined}\n wMin={100}\n >\n {({ xIndex, yIndex }: any) => {\n const index = invertAxis ? yIndex : xIndex;\n const dataItem = data[index];\n const total = this.totalValue(dataItem);\n\n return {\n children: (\n <>\n <HoverRect.Tooltip.Title>{dataItem[groupKey]?.toString()}</HoverRect.Tooltip.Title>\n\n {dataDefinitions.map((item) => {\n return (\n item.checked && (\n <Flex justifyContent='space-between' key={item.id}>\n <HoverRect.Tooltip.Dot mr={4} color={item.color}>\n {item.label}\n </HoverRect.Tooltip.Dot>\n <Text bold>{this.tooltipValueFormatter(dataItem[item.id])}</Text>\n </Flex>\n )\n );\n })}\n\n {showTotalInTooltip === true && (\n <Flex mt={2} justifyContent='space-between'>\n <Box mr={4}>Total</Box>\n <Text bold>{total}</Text>\n </Flex>\n )}\n </>\n ),\n };\n }}\n </HoverRect.Tooltip>\n );\n }\n\n protected getLegendAriaLabel(): string {\n return this.asProps.getI18nText('legendForChart', { chartType: 'Histogram' });\n }\n}\n\nexport const HistogramChart: HistogramChartType = createComponent(HistogramChartComponent);\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA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O,IAAI,CAAChG,OAAO,CAACiG,WAAW,CAAC,gBAAgB,EAAE;QAAEC,SAAS,EAAE;MAAY,CAAC,CAAC;IAC/E;EAAC;AAAA,EA5LmCC,6BAAa;AAAA,IAAAC,gBAAA,aAA7C9G,uBAAuB,iBAKN,iBAAiB;AAAA,IAAA8G,gBAAA,aALlC9G,uBAAuB,aAOV,CAAC,IAAA+G,uBAAW,EAACC,8CAAiB,CAAC,CAAC;AAwL5C,IAAMC,cAAkC,GAAAC,OAAA,CAAAD,cAAA,GAAG,IAAAE,qBAAe,EAACnH,uBAAuB,CAAC","ignoreList":[]}
|
|
@@ -21,12 +21,12 @@ var _intergalacticDynamicLocales = require("../../../translations/__intergalacti
|
|
|
21
21
|
var _BaseLegend2 = require("../BaseLegend");
|
|
22
22
|
var _LegendItem = require("../LegendItem/LegendItem");
|
|
23
23
|
/*!__reshadow-styles__:"./legend-flex.shadow.css"*/
|
|
24
|
-
var style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".
|
|
24
|
+
var style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".___SLegendFlex_1m4w0_gg_._direction_row_1m4w0_gg_{align-items:flex-start;align-content:flex-start;flex-wrap:wrap;gap:8px 16px}.___SLegendFlex_1m4w0_gg_._direction_column_1m4w0_gg_{align-items:flex-start;flex-wrap:wrap;gap:8px}", /*__inner_css_end__*/"1m4w0_gg_"),
|
|
25
25
|
/*__reshadow_css_end__*/
|
|
26
26
|
{
|
|
27
|
-
"__SLegendFlex": "
|
|
28
|
-
"_direction_row": "
|
|
29
|
-
"_direction_column": "
|
|
27
|
+
"__SLegendFlex": "___SLegendFlex_1m4w0_gg_",
|
|
28
|
+
"_direction_row": "_direction_row_1m4w0_gg_",
|
|
29
|
+
"_direction_column": "_direction_column_1m4w0_gg_"
|
|
30
30
|
});
|
|
31
31
|
var LegendFlexRoot = /*#__PURE__*/function (_BaseLegend) {
|
|
32
32
|
function LegendFlexRoot() {
|
|
@@ -24,25 +24,25 @@ var _Pattern = require("../../../Pattern");
|
|
|
24
24
|
var _utils = require("../../../utils");
|
|
25
25
|
var _excluded = ["id", "checked", "color", "onChangeLegendItem", "shape"];
|
|
26
26
|
/*!__reshadow-styles__:"./legend-item.shadow.css"*/
|
|
27
|
-
var style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".
|
|
27
|
+
var style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".___SLegendItem_1umk6_gg_{min-width:0;align-items:flex-start}@media (hover:hover){.___SLegendItem_1umk6_gg_:hover{cursor:pointer}.___SLegendItem_1umk6_gg_.__disabled_1umk6_gg_:hover{cursor:default}}.___SPointShape_1umk6_gg_.__color_1umk6_gg_{background-color:var(--color_1umk6);margin-right:8px;flex-shrink:0}.___SPointShape_1umk6_gg_._shape_Circle_1umk6_gg_._size_l_1umk6_gg_{width:16px;height:16px;border-radius:8px;margin-top:4px}.___SPointShape_1umk6_gg_._shape_Circle_1umk6_gg_._size_m_1umk6_gg_{width:12px;height:12px;border-radius:6px;margin-top:4px}.___SPointShape_1umk6_gg_._shape_Line_1umk6_gg_._size_l_1umk6_gg_{width:16px;height:4px;border-radius:3px;margin-top:9px}.___SPointShape_1umk6_gg_._shape_Line_1umk6_gg_._size_m_1umk6_gg_{width:12px;height:4px;border-radius:3px;margin-top:8px}.___SPointShape_1umk6_gg_._shape_Square_1umk6_gg_._size_l_1umk6_gg_{width:16px;height:16px;border-radius:2px;margin-top:4px}.___SPointShape_1umk6_gg_._shape_Square_1umk6_gg_._size_m_1umk6_gg_{width:12px;height:12px;border-radius:2px;margin-top:4px}.___SPointShape_1umk6_gg_._shape_Pattern_1umk6_gg_{background-color:transparent;margin-right:4px}.___SIcon_1umk6_gg_{line-height:0;margin-right:4px}.___SIcon_1umk6_gg_._size_l_1umk6_gg_{margin-top:4px}.___SIcon_1umk6_gg_._size_m_1umk6_gg_{margin-top:2px}.___SLabel_1umk6_gg_{min-width:0}.___SAdditionalLabel_1umk6_gg_._size_l_1umk6_gg_,.___SCount_1umk6_gg_._size_l_1umk6_gg_,.___SLabel_1umk6_gg_._size_l_1umk6_gg_{font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%)}.___SAdditionalLabel_1umk6_gg_._size_m_1umk6_gg_,.___SCount_1umk6_gg_._size_m_1umk6_gg_,.___SLabel_1umk6_gg_._size_m_1umk6_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%)}.___SAdditionalLabel_1umk6_gg_,.___SCount_1umk6_gg_{margin-left:4px}.___SAdditionalLabel_1umk6_gg_{white-space:nowrap;display:flex;align-items:flex-start}.___SAdditionalLabel_1umk6_gg_::before{content:\"\";display:inline-block;background-color:var(--intergalactic-text-secondary, #6c6e79);height:4px;width:4px;border-radius:2px;margin-right:4px}.___SAdditionalLabel_1umk6_gg_._size_l_1umk6_gg_::before{margin-top:10px}.___SAdditionalLabel_1umk6_gg_._size_m_1umk6_gg_::before{margin-top:8px}.___SPatternSymbol_1umk6_gg_{transform:scale(.8)}", /*__inner_css_end__*/"1umk6_gg_"),
|
|
28
28
|
/*__reshadow_css_end__*/
|
|
29
29
|
{
|
|
30
|
-
"__SLegendItem": "
|
|
31
|
-
"_disabled": "
|
|
32
|
-
"__SPointShape": "
|
|
33
|
-
"_color": "
|
|
34
|
-
"--color": "--
|
|
35
|
-
"_shape_Circle": "
|
|
36
|
-
"_size_l": "
|
|
37
|
-
"_size_m": "
|
|
38
|
-
"_shape_Line": "
|
|
39
|
-
"_shape_Square": "
|
|
40
|
-
"_shape_Pattern": "
|
|
41
|
-
"__SIcon": "
|
|
42
|
-
"__SLabel": "
|
|
43
|
-
"__SAdditionalLabel": "
|
|
44
|
-
"__SCount": "
|
|
45
|
-
"__SPatternSymbol": "
|
|
30
|
+
"__SLegendItem": "___SLegendItem_1umk6_gg_",
|
|
31
|
+
"_disabled": "__disabled_1umk6_gg_",
|
|
32
|
+
"__SPointShape": "___SPointShape_1umk6_gg_",
|
|
33
|
+
"_color": "__color_1umk6_gg_",
|
|
34
|
+
"--color": "--color_1umk6",
|
|
35
|
+
"_shape_Circle": "_shape_Circle_1umk6_gg_",
|
|
36
|
+
"_size_l": "_size_l_1umk6_gg_",
|
|
37
|
+
"_size_m": "_size_m_1umk6_gg_",
|
|
38
|
+
"_shape_Line": "_shape_Line_1umk6_gg_",
|
|
39
|
+
"_shape_Square": "_shape_Square_1umk6_gg_",
|
|
40
|
+
"_shape_Pattern": "_shape_Pattern_1umk6_gg_",
|
|
41
|
+
"__SIcon": "___SIcon_1umk6_gg_",
|
|
42
|
+
"__SLabel": "___SLabel_1umk6_gg_",
|
|
43
|
+
"__SAdditionalLabel": "___SAdditionalLabel_1umk6_gg_",
|
|
44
|
+
"__SCount": "___SCount_1umk6_gg_",
|
|
45
|
+
"__SPatternSymbol": "___SPatternSymbol_1umk6_gg_"
|
|
46
46
|
});
|
|
47
47
|
var enhance = [(0, _resolveColorEnhance["default"])(), (0, _uniqueID["default"])()];
|
|
48
48
|
var LegendItemRoot = /*#__PURE__*/function (_Component) {
|
|
@@ -97,7 +97,10 @@ var LegendItemRoot = /*#__PURE__*/function (_Component) {
|
|
|
97
97
|
value: function getIconProps() {
|
|
98
98
|
var props = this.asProps;
|
|
99
99
|
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), {}, {
|
|
100
|
-
children: props.icon
|
|
100
|
+
children: props.icon,
|
|
101
|
+
onClick: function onClick() {
|
|
102
|
+
return props.onChangeLegendItem(props.id, !props.checked);
|
|
103
|
+
}
|
|
101
104
|
});
|
|
102
105
|
}
|
|
103
106
|
}, {
|
|
@@ -123,18 +126,30 @@ var LegendItemRoot = /*#__PURE__*/function (_Component) {
|
|
|
123
126
|
key: "getAdditionalLabelProps",
|
|
124
127
|
value: function getAdditionalLabelProps() {
|
|
125
128
|
var props = this.asProps;
|
|
126
|
-
var additionalInfo = props.additionalInfo
|
|
129
|
+
var additionalInfo = props.additionalInfo,
|
|
130
|
+
onChangeLegendItem = props.onChangeLegendItem,
|
|
131
|
+
id = props.id,
|
|
132
|
+
checked = props.checked;
|
|
127
133
|
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), {}, {
|
|
128
|
-
children: additionalInfo && 'label' in additionalInfo ? "".concat(additionalInfo.label) : undefined
|
|
134
|
+
children: additionalInfo && 'label' in additionalInfo ? "".concat(additionalInfo.label) : undefined,
|
|
135
|
+
onClick: function onClick() {
|
|
136
|
+
return onChangeLegendItem(id, !checked);
|
|
137
|
+
}
|
|
129
138
|
});
|
|
130
139
|
}
|
|
131
140
|
}, {
|
|
132
141
|
key: "getCountProps",
|
|
133
142
|
value: function getCountProps() {
|
|
134
143
|
var props = this.asProps;
|
|
135
|
-
var additionalInfo = props.additionalInfo
|
|
144
|
+
var additionalInfo = props.additionalInfo,
|
|
145
|
+
onChangeLegendItem = props.onChangeLegendItem,
|
|
146
|
+
id = props.id,
|
|
147
|
+
checked = props.checked;
|
|
136
148
|
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), {}, {
|
|
137
|
-
children: additionalInfo && 'count' in additionalInfo ? "(".concat(additionalInfo.count, ")") : undefined
|
|
149
|
+
children: additionalInfo && 'count' in additionalInfo ? "(".concat(additionalInfo.count, ")") : undefined,
|
|
150
|
+
onClick: function onClick() {
|
|
151
|
+
return onChangeLegendItem(id, !checked);
|
|
152
|
+
}
|
|
138
153
|
});
|
|
139
154
|
}
|
|
140
155
|
}, {
|
|
@@ -149,7 +164,7 @@ var LegendItemRoot = /*#__PURE__*/function (_Component) {
|
|
|
149
164
|
shape = _this$asProps3.shape;
|
|
150
165
|
|
|
151
166
|
// @ts-ignore
|
|
152
|
-
var disabled = _LegendItem.StaticShapes.includes(shape);
|
|
167
|
+
var disabled = _LegendItem.StaticShapes.includes(shape) || shape === undefined;
|
|
153
168
|
return _ref7 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SLegendItem, _ref7.cn("SLegendItem", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
|
|
154
169
|
"disabled": disabled,
|
|
155
170
|
"__excludeProps": ['id']
|
|
@@ -208,7 +223,10 @@ function Shape(props) {
|
|
|
208
223
|
"aria-labelledby": props['aria-labelledby']
|
|
209
224
|
})), patterns && /*#__PURE__*/_react["default"].createElement(_flexBox.Box, _ref9.cn("Box", {
|
|
210
225
|
"mt": '2px',
|
|
211
|
-
"mr": 1
|
|
226
|
+
"mr": 1,
|
|
227
|
+
"onClick": function onClick() {
|
|
228
|
+
return onChange(!checked);
|
|
229
|
+
}
|
|
212
230
|
}), /*#__PURE__*/_react["default"].createElement(SPatternSymbol, _ref9.cn("SPatternSymbol", {
|
|
213
231
|
"color": color,
|
|
214
232
|
"patternKey": patternKey,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LegendItem.js","names":["_core","require","_checkbox","_interopRequireDefault","_resolveColorEnhance","_uniqueID","_flexBox","_typography","_react","_LegendItem","_Pattern","_utils","_excluded","style","sstyled","insert","enhance","resolveColorEnhance","uniqueIDEnhancement","LegendItemRoot","_Component","_classCallCheck2","_callSuper2","arguments","_inherits2","_createClass2","key","value","getUniqueID","uid","asProps","concat","getShapeProps","_this$asProps","checked","color","shape","label","id","size","resolveColor","patterns","onChangeLegendItem","onFocusLegendItem","onBlurLegendItem","onChange","onFocus","onBlur","getIconProps","props","_objectSpread2","children","icon","getLabelProps","_this$asProps2","_color","_shape","_objectWithoutProperties2","onClick","getAdditionalLabelProps","additionalInfo","undefined","getCountProps","count","render","_ref","_ref7","SLegendItem","Flex","_this$asProps3","styles","Children","disabled","StaticShapes","includes","createElement","cn","assignProps","Component","_defineProperty2","Fragment","LegendItemComponent","Shape","Icon","Label","AdditionalLabel","Count","_ref2","arguments[0]","_ref0","SPointShape","Box","SPatternSymbol","PatternSymbol","_props$patternKey","patternKey","getChartDefaultColorName","hasChildren","_ref8","_ref9","_ref13","_ref3","_ref1","SIcon","displayName","_ref14","_ref4","_ref10","SLabel","TypographyText","_ref15","_ref5","_ref11","SAdditionalLabel","_ref16","_ref6","_ref12","SCount","exports","createComponent"],"sources":["../../../../../src/component/ChartLegend/LegendItem/LegendItem.tsx"],"sourcesContent":["import Checkbox from '@semcore/checkbox';\nimport { createComponent, Component, sstyled, Root, type IRootComponentProps } from '@semcore/core';\nimport resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';\nimport uniqueIDEnhancement from '@semcore/core/lib/utils/uniqueID';\nimport { Flex, Box } from '@semcore/flex-box';\nimport { Text as TypographyText } from '@semcore/typography';\nimport type { DOMAttributes } from 'react';\nimport React from 'react';\n\nimport style from './legend-item.shadow.css';\nimport {\n type ShapeProps,\n type LegendItemProps,\n type LegendItemType,\n type LegendItem,\n StaticShapes,\n} from './LegendItem.type';\nimport { PatternSymbol } from '../../../Pattern';\nimport { getChartDefaultColorName } from '../../../utils';\n\nconst enhance = [resolveColorEnhance(), uniqueIDEnhancement()] as const;\nclass LegendItemRoot extends Component<LegendItemProps, {}, {}, typeof enhance> {\n static displayName = 'LegendItem';\n static style = style;\n\n static enhance = enhance;\n\n static defaultProps = () => ({\n children: (\n <>\n <LegendItemComponent.Shape />\n <LegendItemComponent.Icon />\n <LegendItemComponent.Label />\n <LegendItemComponent.AdditionalLabel />\n <LegendItemComponent.Count />\n </>\n ),\n });\n\n getUniqueID() {\n const { uid } = this.asProps;\n return `chart-legend-item-${uid}`;\n }\n\n getShapeProps() {\n const { checked, color, shape, label, id, size, resolveColor, patterns, onChangeLegendItem, onFocusLegendItem, onBlurLegendItem } =\n this.asProps;\n return {\n label,\n shape,\n checked,\n 'color': resolveColor(color),\n 'patternKey': color,\n patterns,\n size,\n 'onChange': (value: boolean) => {\n onChangeLegendItem(id, value);\n },\n 'onFocus': () => onFocusLegendItem(id),\n 'onBlur': () => onBlurLegendItem(id),\n 'aria-labelledby': shape === 'Checkbox' ? this.getUniqueID() : null,\n };\n }\n\n getIconProps(): LegendItem & IRootComponentProps {\n const props = this.asProps;\n\n return {\n ...props,\n children: props.icon,\n };\n }\n\n getLabelProps(): Omit<LegendItem, 'color'> & IRootComponentProps & { onClick: () => void } {\n const { id, checked, color: _color, onChangeLegendItem, shape: _shape, ...props } = this.asProps;\n\n return {\n ...props,\n id: this.getUniqueID(),\n checked,\n onClick: () => onChangeLegendItem(id, !checked),\n children: props.label,\n };\n }\n\n getAdditionalLabelProps(): LegendItem & IRootComponentProps {\n const props = this.asProps;\n\n const { additionalInfo } = props;\n\n return {\n ...props,\n children: additionalInfo && 'label' in additionalInfo ? `${additionalInfo.label}` : undefined,\n };\n }\n\n getCountProps(): LegendItem & IRootComponentProps {\n const props = this.asProps;\n\n const { additionalInfo } = props;\n\n return {\n ...props,\n children:\n additionalInfo && 'count' in additionalInfo ? `(${additionalInfo.count})` : undefined,\n };\n }\n\n render() {\n const SLegendItem = Root;\n const { styles, Children, shape } = this.asProps;\n\n // @ts-ignore\n const disabled = StaticShapes.includes(shape);\n\n return sstyled(styles)(\n <SLegendItem render={Flex} disabled={disabled} __excludeProps={['id']}>\n <Children />\n </SLegendItem>,\n );\n }\n}\n\nfunction Shape(props: IRootComponentProps & ShapeProps & DOMAttributes<HTMLLabelElement>) {\n const SPointShape = Root;\n const SPatternSymbol = PatternSymbol;\n const {\n styles,\n size,\n shape,\n checked,\n color,\n patternKey = getChartDefaultColorName(0),\n Children,\n children: hasChildren,\n patterns,\n onChange,\n onFocus,\n onBlur,\n } = props;\n\n if (hasChildren) {\n return <Children />;\n }\n\n if (shape === 'Pattern') {\n return sstyled(styles)(\n <Box mr={1}>\n <SPatternSymbol color={color} patternKey={patternKey} aria-hidden />\n </Box>,\n );\n }\n\n if (shape === 'Checkbox') {\n return sstyled(styles)(\n <>\n <Checkbox\n size={size}\n checked={checked}\n theme={checked ? color : undefined}\n onChange={onChange}\n onFocus={onFocus}\n onBlur={onBlur}\n aria-labelledby={props['aria-labelledby']}\n />\n {patterns && (\n <Box mt='2px' mr={1}>\n <SPatternSymbol color={color} patternKey={patternKey} aria-hidden />\n </Box>\n )}\n </>,\n );\n }\n\n return sstyled(styles)(\n <SPointShape render={Box}>\n <Children />\n </SPointShape>,\n );\n}\n\nfunction Icon({ styles, children: hasChildren, Children }: IRootComponentProps) {\n const SIcon = Root;\n\n if (!hasChildren) {\n return null;\n }\n\n return sstyled(styles)(\n <SIcon render={Box} tag='span'>\n <Children />\n </SIcon>,\n );\n}\nIcon.displayName = 'Icon';\n\nfunction Label({ styles, children: hasChildren, Children }: IRootComponentProps) {\n const SLabel = Root;\n\n if (!hasChildren) {\n return null;\n }\n\n return sstyled(styles)(\n <SLabel render={TypographyText} use='primary'>\n <Children />\n </SLabel>,\n );\n}\nLabel.displayName = 'Label';\n\nfunction AdditionalLabel({ styles, children: hasChildren, Children }: IRootComponentProps) {\n const SAdditionalLabel = Root;\n\n if (!hasChildren) {\n return null;\n }\n\n return sstyled(styles)(\n <SAdditionalLabel render={TypographyText} use='secondary'>\n <Children />\n </SAdditionalLabel>,\n );\n}\nAdditionalLabel.displayName = 'AdditionalLabel';\n\nfunction Count({ styles, children: hasChildren, Children }: IRootComponentProps) {\n const SCount = Root;\n\n if (!hasChildren) {\n return null;\n }\n\n return sstyled(styles)(\n <SCount render={TypographyText} use='secondary'>\n <Children />\n </SCount>,\n );\n}\nCount.displayName = 'Count';\n\nexport const LegendItemComponent: LegendItemType = createComponent(LegendItemRoot, {\n Shape,\n Icon,\n Label,\n AdditionalLabel,\n Count,\n});\n"],"mappings":";;;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AADA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,oBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,SAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAEA,IAAAO,MAAA,GAAAL,sBAAA,CAAAF,OAAA;AAG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AALA,KAAK;EACLC,eAAe,EAAfA,eAAe;EACfC,KAAK,EAALA;AACF,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"LegendItem.js","names":["_core","require","_checkbox","_interopRequireDefault","_resolveColorEnhance","_uniqueID","_flexBox","_typography","_react","_LegendItem","_Pattern","_utils","_excluded","style","sstyled","insert","enhance","resolveColorEnhance","uniqueIDEnhancement","LegendItemRoot","_Component","_classCallCheck2","_callSuper2","arguments","_inherits2","_createClass2","key","value","getUniqueID","uid","asProps","concat","getShapeProps","_this$asProps","checked","color","shape","label","id","size","resolveColor","patterns","onChangeLegendItem","onFocusLegendItem","onBlurLegendItem","onChange","onFocus","onBlur","getIconProps","props","_objectSpread2","children","icon","onClick","getLabelProps","_this$asProps2","_color","_shape","_objectWithoutProperties2","getAdditionalLabelProps","additionalInfo","undefined","getCountProps","count","render","_ref","_ref7","SLegendItem","Flex","_this$asProps3","styles","Children","disabled","StaticShapes","includes","createElement","cn","assignProps","Component","_defineProperty2","Fragment","LegendItemComponent","Shape","Icon","Label","AdditionalLabel","Count","_ref2","arguments[0]","_ref0","SPointShape","Box","SPatternSymbol","PatternSymbol","_props$patternKey","patternKey","getChartDefaultColorName","hasChildren","_ref8","_ref9","_ref13","_ref3","_ref1","SIcon","displayName","_ref14","_ref4","_ref10","SLabel","TypographyText","_ref15","_ref5","_ref11","SAdditionalLabel","_ref16","_ref6","_ref12","SCount","exports","createComponent"],"sources":["../../../../../src/component/ChartLegend/LegendItem/LegendItem.tsx"],"sourcesContent":["import Checkbox from '@semcore/checkbox';\nimport { createComponent, Component, sstyled, Root, type IRootComponentProps } from '@semcore/core';\nimport resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';\nimport uniqueIDEnhancement from '@semcore/core/lib/utils/uniqueID';\nimport { Flex, Box } from '@semcore/flex-box';\nimport { Text as TypographyText } from '@semcore/typography';\nimport type { DOMAttributes } from 'react';\nimport React from 'react';\n\nimport style from './legend-item.shadow.css';\nimport {\n type ShapeProps,\n type LegendItemProps,\n type LegendItemType,\n type LegendItem,\n StaticShapes,\n} from './LegendItem.type';\nimport { PatternSymbol } from '../../../Pattern';\nimport { getChartDefaultColorName } from '../../../utils';\n\nconst enhance = [resolveColorEnhance(), uniqueIDEnhancement()] as const;\nclass LegendItemRoot extends Component<LegendItemProps, {}, {}, typeof enhance> {\n static displayName = 'LegendItem';\n static style = style;\n\n static enhance = enhance;\n\n static defaultProps = () => ({\n children: (\n <>\n <LegendItemComponent.Shape />\n <LegendItemComponent.Icon />\n <LegendItemComponent.Label />\n <LegendItemComponent.AdditionalLabel />\n <LegendItemComponent.Count />\n </>\n ),\n });\n\n getUniqueID() {\n const { uid } = this.asProps;\n return `chart-legend-item-${uid}`;\n }\n\n getShapeProps() {\n const { checked, color, shape, label, id, size, resolveColor, patterns, onChangeLegendItem, onFocusLegendItem, onBlurLegendItem } =\n this.asProps;\n return {\n label,\n shape,\n checked,\n 'color': resolveColor(color),\n 'patternKey': color,\n patterns,\n size,\n 'onChange': (value: boolean) => {\n onChangeLegendItem(id, value);\n },\n 'onFocus': () => onFocusLegendItem(id),\n 'onBlur': () => onBlurLegendItem(id),\n 'aria-labelledby': shape === 'Checkbox' ? this.getUniqueID() : null,\n };\n }\n\n getIconProps(): LegendItem & IRootComponentProps & { onClick: () => void } {\n const props = this.asProps;\n\n return {\n ...props,\n children: props.icon,\n onClick: () => props.onChangeLegendItem(props.id, !props.checked),\n };\n }\n\n getLabelProps(): Omit<LegendItem, 'color'> & IRootComponentProps & { onClick: () => void } {\n const { id, checked, color: _color, onChangeLegendItem, shape: _shape, ...props } = this.asProps;\n\n return {\n ...props,\n id: this.getUniqueID(),\n checked,\n onClick: () => onChangeLegendItem(id, !checked),\n children: props.label,\n };\n }\n\n getAdditionalLabelProps(): LegendItem & IRootComponentProps & { onClick: () => void } {\n const props = this.asProps;\n\n const { additionalInfo, onChangeLegendItem, id, checked } = props;\n\n return {\n ...props,\n children: additionalInfo && 'label' in additionalInfo ? `${additionalInfo.label}` : undefined,\n onClick: () => onChangeLegendItem(id, !checked),\n };\n }\n\n getCountProps(): LegendItem & IRootComponentProps & { onClick: () => void } {\n const props = this.asProps;\n\n const { additionalInfo, onChangeLegendItem, id, checked } = props;\n\n return {\n ...props,\n children:\n additionalInfo && 'count' in additionalInfo ? `(${additionalInfo.count})` : undefined,\n onClick: () => onChangeLegendItem(id, !checked),\n };\n }\n\n render() {\n const SLegendItem = Root;\n const { styles, Children, shape } = this.asProps;\n\n // @ts-ignore\n const disabled = StaticShapes.includes(shape) || shape === undefined;\n\n return sstyled(styles)(\n <SLegendItem render={Flex} disabled={disabled} __excludeProps={['id']}>\n <Children />\n </SLegendItem>,\n );\n }\n}\n\nfunction Shape(props: IRootComponentProps & ShapeProps & DOMAttributes<HTMLLabelElement>) {\n const SPointShape = Root;\n const SPatternSymbol = PatternSymbol;\n const {\n styles,\n size,\n shape,\n checked,\n color,\n patternKey = getChartDefaultColorName(0),\n Children,\n children: hasChildren,\n patterns,\n onChange,\n onFocus,\n onBlur,\n } = props;\n\n if (hasChildren) {\n return <Children />;\n }\n\n if (shape === 'Pattern') {\n return sstyled(styles)(\n <Box mr={1}>\n <SPatternSymbol color={color} patternKey={patternKey} aria-hidden />\n </Box>,\n );\n }\n\n if (shape === 'Checkbox') {\n return sstyled(styles)(\n <>\n <Checkbox\n size={size}\n checked={checked}\n theme={checked ? color : undefined}\n onChange={onChange}\n onFocus={onFocus}\n onBlur={onBlur}\n aria-labelledby={props['aria-labelledby']}\n />\n {patterns && (\n <Box mt='2px' mr={1} onClick={() => onChange(!checked)}>\n <SPatternSymbol color={color} patternKey={patternKey} aria-hidden />\n </Box>\n )}\n </>,\n );\n }\n\n return sstyled(styles)(\n <SPointShape render={Box}>\n <Children />\n </SPointShape>,\n );\n}\n\nfunction Icon({ styles, children: hasChildren, Children }: IRootComponentProps) {\n const SIcon = Root;\n\n if (!hasChildren) {\n return null;\n }\n\n return sstyled(styles)(\n <SIcon render={Box} tag='span'>\n <Children />\n </SIcon>,\n );\n}\nIcon.displayName = 'Icon';\n\nfunction Label({ styles, children: hasChildren, Children }: IRootComponentProps) {\n const SLabel = Root;\n\n if (!hasChildren) {\n return null;\n }\n\n return sstyled(styles)(\n <SLabel render={TypographyText} use='primary'>\n <Children />\n </SLabel>,\n );\n}\nLabel.displayName = 'Label';\n\nfunction AdditionalLabel({ styles, children: hasChildren, Children }: IRootComponentProps) {\n const SAdditionalLabel = Root;\n\n if (!hasChildren) {\n return null;\n }\n\n return sstyled(styles)(\n <SAdditionalLabel render={TypographyText} use='secondary'>\n <Children />\n </SAdditionalLabel>,\n );\n}\nAdditionalLabel.displayName = 'AdditionalLabel';\n\nfunction Count({ styles, children: hasChildren, Children }: IRootComponentProps) {\n const SCount = Root;\n\n if (!hasChildren) {\n return null;\n }\n\n return sstyled(styles)(\n <SCount render={TypographyText} use='secondary'>\n <Children />\n </SCount>,\n );\n}\nCount.displayName = 'Count';\n\nexport const LegendItemComponent: LegendItemType = createComponent(LegendItemRoot, {\n Shape,\n Icon,\n Label,\n AdditionalLabel,\n Count,\n});\n"],"mappings":";;;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AADA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,oBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,SAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAEA,IAAAO,MAAA,GAAAL,sBAAA,CAAAF,OAAA;AAGA,IAAAQ,WAAA,GAAAR,OAAA;AAOA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AAA0D,IAAAW,SAAA;AAAA;AAAA,IAAAC,KAAA,8BAAAb,KAAA,CAAAc,OAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAA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AAAmB,MAAA,GAAO,IAAAtG,aAAO,EAACwD,MAAM,CAAC,eACpB9D,MAAA,YAAAmE,aAAA,CAAC0C,MAAM,EAAAD,MAAA,CAAAxC,EAAA,eAAA1B,cAAA,qBAAAlD,KAAA,CAAA6E,WAAA;IAAA,OAA6B;EAAW,GAAAsC,KAAA,kBAC7C3G,MAAA,YAAAmE,aAAA,CAACJ,QAAQ,EAAA6C,MAAA,CAAAxC,EAAA,gBAAE,CACL,CAAC;AAEb;AACAU,KAAK,CAACkB,WAAW,GAAG,OAAO;AAEpB,IAAMvB,mBAAmC,GAAAqC,OAAA,CAAArC,mBAAA,GAAG,IAAAsC,qBAAe,EAACpG,cAAc,EAAE;EACjF+D,KAAK,EAALA,KAAK;EACLC,IAAI,EAAJA,IAAI;EACJC,KAAK,EAALA,KAAK;EACLC,eAAe,EAAfA,eAAe;EACfC,KAAK,EAALA;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -17,14 +17,14 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
17
17
|
var _BaseLegend2 = require("../BaseLegend");
|
|
18
18
|
var _LegendItem = require("../LegendItem/LegendItem");
|
|
19
19
|
/*!__reshadow-styles__:"./legend-table.shadow.css"*/
|
|
20
|
-
var style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".
|
|
20
|
+
var style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".___SLegendTable_um1ci_gg_.__columns-count_um1ci_gg_{font-feature-settings:\"tnum\";font-variant-numeric:tabular-nums;display:grid;grid-template-columns:auto .2fr;align-items:center;height:-moz-fit-content;height:fit-content;grid-column-gap:16px;grid-row-gap:8px}.___SColumnItem_um1ci_gg_._size_l_um1ci_gg_{font-size:var(--intergalactic-fs-300, 16px);text-align:right}.___SColumnItem_um1ci_gg_._size_m_um1ci_gg_{font-size:var(--intergalactic-fs-200, 14px);text-align:right}", /*__inner_css_end__*/"um1ci_gg_"),
|
|
21
21
|
/*__reshadow_css_end__*/
|
|
22
22
|
{
|
|
23
|
-
"__SLegendTable": "
|
|
24
|
-
"_columns-count": "__columns-
|
|
25
|
-
"__SColumnItem": "
|
|
26
|
-
"_size_l": "
|
|
27
|
-
"_size_m": "
|
|
23
|
+
"__SLegendTable": "___SLegendTable_um1ci_gg_",
|
|
24
|
+
"_columns-count": "__columns-count_um1ci_gg_",
|
|
25
|
+
"__SColumnItem": "___SColumnItem_um1ci_gg_",
|
|
26
|
+
"_size_l": "_size_l_um1ci_gg_",
|
|
27
|
+
"_size_m": "_size_m_um1ci_gg_"
|
|
28
28
|
});
|
|
29
29
|
var LegendTableRoot = /*#__PURE__*/function (_BaseLegend) {
|
|
30
30
|
function LegendTableRoot() {
|
|
@@ -61,28 +61,64 @@ STick[position='bottom'] {
|
|
|
61
61
|
transform: translateY(12px);
|
|
62
62
|
text-anchor: middle;
|
|
63
63
|
dominant-baseline: hanging;
|
|
64
|
+
|
|
65
|
+
tspan {
|
|
66
|
+
dominant-baseline: hanging;
|
|
67
|
+
}
|
|
64
68
|
}
|
|
65
69
|
|
|
66
70
|
STick[position='right'] {
|
|
67
71
|
transform: translateX(16px);
|
|
68
72
|
text-anchor: start;
|
|
69
73
|
dominant-baseline: middle;
|
|
74
|
+
|
|
75
|
+
tspan {
|
|
76
|
+
dominant-baseline: middle;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&[multiline] {
|
|
80
|
+
dominant-baseline: auto;
|
|
81
|
+
|
|
82
|
+
tspan {
|
|
83
|
+
dominant-baseline: auto;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
70
86
|
}
|
|
71
87
|
|
|
72
88
|
STick[position='left'] {
|
|
73
89
|
transform: translateX(-16px);
|
|
74
90
|
text-anchor: end;
|
|
75
91
|
dominant-baseline: middle;
|
|
92
|
+
|
|
93
|
+
tspan {
|
|
94
|
+
dominant-baseline: middle;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&[multiline] {
|
|
98
|
+
dominant-baseline: auto;
|
|
99
|
+
|
|
100
|
+
tspan {
|
|
101
|
+
dominant-baseline: auto;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
76
104
|
}
|
|
77
105
|
|
|
78
106
|
STick[position='custom_0'] {
|
|
79
107
|
transform: translateY(12px);
|
|
80
108
|
text-anchor: middle;
|
|
81
109
|
dominant-baseline: hanging;
|
|
110
|
+
|
|
111
|
+
tspan {
|
|
112
|
+
dominant-baseline: hanging;
|
|
113
|
+
}
|
|
82
114
|
}
|
|
83
115
|
|
|
84
116
|
STick[position='custom_1'] {
|
|
85
117
|
transform: translateX(-16px);
|
|
86
118
|
text-anchor: end;
|
|
87
119
|
dominant-baseline: middle;
|
|
120
|
+
|
|
121
|
+
tspan {
|
|
122
|
+
dominant-baseline: middle;
|
|
123
|
+
}
|
|
88
124
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Axis.d.js","names":[],"sources":["../../../src/types/Axis.d.ts"],"sourcesContent":["import type { UnknownProperties } from '@semcore/core';\n\nimport type { Context } from './context';\nimport type { IntergalacticD3Component } from './Plot';\n\n/** @deprecated */\nexport interface IXAxisProps extends XAxisProps, UnknownProperties {}\nexport type XAxisProps = Context & {\n /** The position of the axis relative chart\n * @default 'button' */\n position?: 'top' | 'right' | 'bottom' | 'left' | number;\n /** Element hide property\n * @default false */\n hide?: boolean;\n /** Values for axis ticks */\n ticks?: any[];\n};\n\n/** @deprecated */\nexport interface IYAxisProps extends YAxisProps, UnknownProperties {}\nexport type YAxisProps = Context & {\n /** The position of the axis relative chart\n * @default 'left' */\n position?: 'top' | 'right' | 'bottom' | 'left' | number;\n /** Element hide property\n * @default true */\n hide?: boolean;\n /** Values for axis ticks */\n ticks?: any[];\n};\n\n/** @deprecated */\nexport interface IAxisTicksProps extends AxisTicksProps, UnknownProperties {}\nexport type AxisTicksProps = Context & {\n /** The position of the axis relative chart */\n position?: 'top' | 'right' | 'bottom' | 'left';\n /** Element hide property */\n hide?: boolean;\n /** Values for axis ticks */\n ticks?: any[];\n};\n\n/** @deprecated */\nexport interface IAxisGridProps extends AxisGridProps, UnknownProperties {}\nexport type AxisGridProps = Context & {\n /** Values for axis ticks */\n ticks?: any[];\n};\n\n/** @deprecated */\nexport interface IAxisTitleProps extends AxisTitleProps, UnknownProperties {}\nexport type AxisTitleProps = Context & {\n /** The position of the axis relative chart */\n position?: 'top' | 'right' | 'bottom' | 'left';\n\n /** For vertical titles disables characters rotation while puts\n * characters into the vertical column for better reading in some languages.\n * @default true for `zh` and `ja` locales and false for all others.\n */\n verticalWritingMode?: boolean;\n};\n\n/** @deprecated */\nexport interface IAxisTicksContext extends AxisTicksContext, UnknownProperties {}\nexport type AxisTicksContext = {\n /** Value element of data */\n /** @deprecated */\n value: any;\n /** Index element of data */\n index: number;\n /** Horizontal coordinate of tick */\n x: number;\n /** Vertical coordinate of tick */\n y: number;\n /** Size of plot */\n size: [width: number, height: number];\n};\n\ndeclare const XAxis: IntergalacticD3Component<'path', XAxisProps> & {\n Ticks: IntergalacticD3Component<'path', AxisTicksProps, AxisTicksContext>;\n Grid: IntergalacticD3Component<'path', AxisGridProps>;\n Title: IntergalacticD3Component<'text', AxisTitleProps>;\n};\n\ndeclare const YAxis: IntergalacticD3Component<'path', YAxisProps> & {\n Ticks: IntergalacticD3Component<'path', AxisTicksProps, AxisTicksContext>;\n Grid: IntergalacticD3Component<'path', AxisGridProps>;\n Title: IntergalacticD3Component<'text', AxisTitleProps>;\n};\n\nexport { XAxis, YAxis };\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Axis.d.js","names":[],"sources":["../../../src/types/Axis.d.ts"],"sourcesContent":["import type { UnknownProperties } from '@semcore/core';\n\nimport type { Context } from './context';\nimport type { IntergalacticD3Component } from './Plot';\n\n/** @deprecated */\nexport interface IXAxisProps extends XAxisProps, UnknownProperties {}\nexport type XAxisProps = Context & {\n /** The position of the axis relative chart\n * @default 'button' */\n position?: 'top' | 'right' | 'bottom' | 'left' | number;\n /** Element hide property\n * @default false */\n hide?: boolean;\n /** Values for axis ticks */\n ticks?: any[];\n};\n\n/** @deprecated */\nexport interface IYAxisProps extends YAxisProps, UnknownProperties {}\nexport type YAxisProps = Context & {\n /** The position of the axis relative chart\n * @default 'left' */\n position?: 'top' | 'right' | 'bottom' | 'left' | number;\n /** Element hide property\n * @default true */\n hide?: boolean;\n /** Values for axis ticks */\n ticks?: any[];\n};\n\n/** @deprecated */\nexport interface IAxisTicksProps extends AxisTicksProps, UnknownProperties {}\nexport type AxisTicksProps = Context & {\n /** The position of the axis relative chart */\n position?: 'top' | 'right' | 'bottom' | 'left';\n /** Element hide property */\n hide?: boolean;\n /** Values for axis ticks */\n ticks?: any[];\n /** Enables multiline tick labels, applicable only for band scales */\n multiline?: boolean;\n};\n\n/** @deprecated */\nexport interface IAxisGridProps extends AxisGridProps, UnknownProperties {}\nexport type AxisGridProps = Context & {\n /** Values for axis ticks */\n ticks?: any[];\n};\n\n/** @deprecated */\nexport interface IAxisTitleProps extends AxisTitleProps, UnknownProperties {}\nexport type AxisTitleProps = Context & {\n /** The position of the axis relative chart */\n position?: 'top' | 'right' | 'bottom' | 'left';\n\n /** For vertical titles disables characters rotation while puts\n * characters into the vertical column for better reading in some languages.\n * @default true for `zh` and `ja` locales and false for all others.\n */\n verticalWritingMode?: boolean;\n};\n\n/** @deprecated */\nexport interface IAxisTicksContext extends AxisTicksContext, UnknownProperties {}\nexport type AxisTicksContext = {\n /** Value element of data */\n /** @deprecated */\n value: any;\n /** Index element of data */\n index: number;\n /** Horizontal coordinate of tick */\n x: number;\n /** Vertical coordinate of tick */\n y: number;\n /** Size of plot */\n size: [width: number, height: number];\n};\n\ndeclare const XAxis: IntergalacticD3Component<'path', XAxisProps> & {\n Ticks: IntergalacticD3Component<'path', AxisTicksProps, AxisTicksContext>;\n Grid: IntergalacticD3Component<'path', AxisGridProps>;\n Title: IntergalacticD3Component<'text', AxisTitleProps>;\n};\n\ndeclare const YAxis: IntergalacticD3Component<'path', YAxisProps> & {\n Ticks: IntergalacticD3Component<'path', AxisTicksProps, AxisTicksContext>;\n Grid: IntergalacticD3Component<'path', AxisGridProps>;\n Title: IntergalacticD3Component<'text', AxisTitleProps>;\n};\n\nexport { XAxis, YAxis };\n"],"mappings":"","ignoreList":[]}
|