mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
refactor(types): consolidate shared table types and fix Funnel enum typo (#37768)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -28,7 +28,7 @@ import {
|
||||
} from '@superset-ui/chart-controls';
|
||||
import {
|
||||
DEFAULT_FORM_DATA,
|
||||
EchartsFunnelLabelTypeType,
|
||||
EchartsFunnelLabelType,
|
||||
PercentCalcType,
|
||||
} from './types';
|
||||
import { legendSection } from '../controls';
|
||||
@@ -107,20 +107,20 @@ const config: ControlPanelConfig = {
|
||||
default: labelType,
|
||||
renderTrigger: true,
|
||||
choices: [
|
||||
[EchartsFunnelLabelTypeType.Key, t('Category Name')],
|
||||
[EchartsFunnelLabelTypeType.Value, t('Value')],
|
||||
[EchartsFunnelLabelTypeType.Percent, t('Percentage')],
|
||||
[EchartsFunnelLabelTypeType.KeyValue, t('Category and Value')],
|
||||
[EchartsFunnelLabelType.Key, t('Category Name')],
|
||||
[EchartsFunnelLabelType.Value, t('Value')],
|
||||
[EchartsFunnelLabelType.Percent, t('Percentage')],
|
||||
[EchartsFunnelLabelType.KeyValue, t('Category and Value')],
|
||||
[
|
||||
EchartsFunnelLabelTypeType.KeyPercent,
|
||||
EchartsFunnelLabelType.KeyPercent,
|
||||
t('Category and Percentage'),
|
||||
],
|
||||
[
|
||||
EchartsFunnelLabelTypeType.KeyValuePercent,
|
||||
EchartsFunnelLabelType.KeyValuePercent,
|
||||
t('Category, Value and Percentage'),
|
||||
],
|
||||
[
|
||||
EchartsFunnelLabelTypeType.ValuePercent,
|
||||
EchartsFunnelLabelType.ValuePercent,
|
||||
t('Value and Percentage'),
|
||||
],
|
||||
],
|
||||
@@ -137,16 +137,16 @@ const config: ControlPanelConfig = {
|
||||
default: defaultTooltipLabel,
|
||||
renderTrigger: true,
|
||||
choices: [
|
||||
[EchartsFunnelLabelTypeType.Key, t('Category Name')],
|
||||
[EchartsFunnelLabelTypeType.Value, t('Value')],
|
||||
[EchartsFunnelLabelTypeType.Percent, t('Percentage')],
|
||||
[EchartsFunnelLabelTypeType.KeyValue, t('Category and Value')],
|
||||
[EchartsFunnelLabelType.Key, t('Category Name')],
|
||||
[EchartsFunnelLabelType.Value, t('Value')],
|
||||
[EchartsFunnelLabelType.Percent, t('Percentage')],
|
||||
[EchartsFunnelLabelType.KeyValue, t('Category and Value')],
|
||||
[
|
||||
EchartsFunnelLabelTypeType.KeyPercent,
|
||||
EchartsFunnelLabelType.KeyPercent,
|
||||
t('Category and Percentage'),
|
||||
],
|
||||
[
|
||||
EchartsFunnelLabelTypeType.KeyValuePercent,
|
||||
EchartsFunnelLabelType.KeyValuePercent,
|
||||
t('Category, Value and Percentage'),
|
||||
],
|
||||
],
|
||||
|
||||
@@ -35,7 +35,7 @@ import {
|
||||
DEFAULT_FORM_DATA as DEFAULT_FUNNEL_FORM_DATA,
|
||||
EchartsFunnelChartProps,
|
||||
EchartsFunnelFormData,
|
||||
EchartsFunnelLabelTypeType,
|
||||
EchartsFunnelLabelType,
|
||||
FunnelChartTransformedProps,
|
||||
PercentCalcType,
|
||||
} from './types';
|
||||
@@ -215,19 +215,19 @@ export default function transformProps(
|
||||
percentCalculationType,
|
||||
});
|
||||
switch (labelType) {
|
||||
case EchartsFunnelLabelTypeType.Key:
|
||||
case EchartsFunnelLabelType.Key:
|
||||
return name;
|
||||
case EchartsFunnelLabelTypeType.Value:
|
||||
case EchartsFunnelLabelType.Value:
|
||||
return formattedValue;
|
||||
case EchartsFunnelLabelTypeType.Percent:
|
||||
case EchartsFunnelLabelType.Percent:
|
||||
return formattedPercent;
|
||||
case EchartsFunnelLabelTypeType.KeyValue:
|
||||
case EchartsFunnelLabelType.KeyValue:
|
||||
return `${name}: ${formattedValue}`;
|
||||
case EchartsFunnelLabelTypeType.KeyValuePercent:
|
||||
case EchartsFunnelLabelType.KeyValuePercent:
|
||||
return `${name}: ${formattedValue} (${formattedPercent})`;
|
||||
case EchartsFunnelLabelTypeType.KeyPercent:
|
||||
case EchartsFunnelLabelType.KeyPercent:
|
||||
return `${name}: ${formattedPercent}`;
|
||||
case EchartsFunnelLabelTypeType.ValuePercent:
|
||||
case EchartsFunnelLabelType.ValuePercent:
|
||||
return `${formattedValue} (${formattedPercent})`;
|
||||
default:
|
||||
return name;
|
||||
@@ -283,7 +283,7 @@ export default function transformProps(
|
||||
percentCalculationType,
|
||||
});
|
||||
const row = [];
|
||||
const enumName = EchartsFunnelLabelTypeType[tooltipLabelType];
|
||||
const enumName = EchartsFunnelLabelType[tooltipLabelType];
|
||||
const title = enumName.includes('Key') ? name : undefined;
|
||||
if (enumName.includes('Value') || enumName.includes('Percent')) {
|
||||
row.push(metricLabel);
|
||||
|
||||
@@ -33,8 +33,8 @@ export type EchartsFunnelFormData = QueryFormData &
|
||||
colorScheme?: string;
|
||||
groupby: QueryFormData[];
|
||||
labelLine: boolean;
|
||||
labelType: EchartsFunnelLabelTypeType;
|
||||
tooltipLabelType: EchartsFunnelLabelTypeType;
|
||||
labelType: EchartsFunnelLabelType;
|
||||
tooltipLabelType: EchartsFunnelLabelType;
|
||||
metric?: string;
|
||||
showLabels: boolean;
|
||||
showTooltipLabels: boolean;
|
||||
@@ -45,7 +45,7 @@ export type EchartsFunnelFormData = QueryFormData &
|
||||
percentCalculationType: PercentCalcType;
|
||||
};
|
||||
|
||||
export enum EchartsFunnelLabelTypeType {
|
||||
export enum EchartsFunnelLabelType {
|
||||
Key,
|
||||
Value,
|
||||
Percent,
|
||||
@@ -64,8 +64,8 @@ export const DEFAULT_FORM_DATA: EchartsFunnelFormData = {
|
||||
...DEFAULT_LEGEND_FORM_DATA,
|
||||
groupby: [],
|
||||
labelLine: false,
|
||||
labelType: EchartsFunnelLabelTypeType.Key,
|
||||
defaultTooltipLabel: EchartsFunnelLabelTypeType.KeyValuePercent,
|
||||
labelType: EchartsFunnelLabelType.Key,
|
||||
defaultTooltipLabel: EchartsFunnelLabelType.KeyValuePercent,
|
||||
legendOrientation: LegendOrientation.Top,
|
||||
legendType: LegendType.Scroll,
|
||||
numberFormat: 'SMART_NUMBER',
|
||||
|
||||
Reference in New Issue
Block a user