chore: make TS enums strictly PascalCase (#26875)

This commit is contained in:
Ville Brofeldt
2024-01-31 17:40:44 -08:00
committed by GitHub
parent 959a5a5ad6
commit 19f8405bc0
362 changed files with 2002 additions and 2032 deletions

View File

@@ -113,7 +113,7 @@ export default {
? colnames
.filter(
(colname: string, index: number) =>
coltypes[index] === GenericDataType.NUMERIC,
coltypes[index] === GenericDataType.Numeric,
)
.map(colname => ({
value: colname,

View File

@@ -46,7 +46,7 @@ const metadata = {
t('Description'),
],
thumbnail,
behaviors: [Behavior.DRILL_TO_DETAIL],
behaviors: [Behavior.DrillToDetail],
};
export default class BigNumberTotalChartPlugin extends EchartsChartPlugin<

View File

@@ -85,8 +85,8 @@ export default function transformProps(
);
const headerFormatter =
coltypes[0] === GenericDataType.TEMPORAL ||
coltypes[0] === GenericDataType.STRING ||
coltypes[0] === GenericDataType.Temporal ||
coltypes[0] === GenericDataType.String ||
forceTimestampFormatting
? formatTime
: numberFormatter;

View File

@@ -45,7 +45,7 @@ const metadata = {
t('Trend'),
],
thumbnail,
behaviors: [Behavior.DRILL_TO_DETAIL],
behaviors: [Behavior.DrillToDetail],
};
export default class BigNumberWithTrendlineChartPlugin extends EchartsChartPlugin<

View File

@@ -185,8 +185,8 @@ export default function transformProps(
);
const headerFormatter =
metricColtype === GenericDataType.TEMPORAL ||
metricColtype === GenericDataType.STRING ||
metricColtype === GenericDataType.Temporal ||
metricColtype === GenericDataType.String ||
forceTimestampFormatting
? formatTime
: numberFormatter;

View File

@@ -46,9 +46,9 @@ export default class EchartsBoxPlotChartPlugin extends EchartsChartPlugin<
loadChart: () => import('./EchartsBoxPlot'),
metadata: {
behaviors: [
Behavior.INTERACTIVE_CHART,
Behavior.DRILL_TO_DETAIL,
Behavior.DRILL_BY,
Behavior.InteractiveChart,
Behavior.DrillToDetail,
Behavior.DrillBy,
],
category: t('Distribution'),
credits: ['https://echarts.apache.org'],

View File

@@ -35,7 +35,7 @@ export default class EchartsBubbleChartPlugin extends ChartPlugin<
controlPanel,
loadChart: () => import('./EchartsBubble'),
metadata: new ChartMetadata({
behaviors: [Behavior.INTERACTIVE_CHART],
behaviors: [Behavior.InteractiveChart],
category: t('Correlation'),
credits: ['https://echarts.apache.org'],
description: t(

View File

@@ -158,7 +158,7 @@ export default function transformProps(chartProps: EchartsBubbleChartProps) {
convertInteger(xAxisTitleMargin),
);
const xAxisType = logXAxis ? AxisType.log : AxisType.value;
const xAxisType = logXAxis ? AxisType.Log : AxisType.Value;
const echartOptions: EChartsCoreOption = {
series,
xAxis: {
@@ -196,7 +196,7 @@ export default function transformProps(chartProps: EchartsBubbleChartProps) {
nameGap: convertInteger(yAxisTitleMargin),
min: yAxisMin,
max: yAxisMax,
type: logYAxis ? AxisType.log : AxisType.value,
type: logYAxis ? AxisType.Log : AxisType.Value,
},
legend: {
...getLegendProps(legendType, legendOrientation, showLegend, theme),

View File

@@ -82,11 +82,14 @@ const config: ControlPanelConfig = {
'Display percents in the label and tooltip as the percent of the total value, from the first step of the funnel, or from the previous step in the funnel.',
),
choices: [
[PercentCalcType.FIRST_STEP, t('Calculate from first step')],
[PercentCalcType.PREV_STEP, t('Calculate from previous step')],
[PercentCalcType.TOTAL, t('Percent of total')],
[PercentCalcType.FirstStep, t('Calculate from first step')],
[
PercentCalcType.PreviousStep,
t('Calculate from previous step'),
],
[PercentCalcType.Total, t('Percent of total')],
],
default: PercentCalcType.FIRST_STEP,
default: PercentCalcType.FirstStep,
renderTrigger: true,
},
},

View File

@@ -46,9 +46,9 @@ export default class EchartsFunnelChartPlugin extends EchartsChartPlugin<
loadChart: () => import('./EchartsFunnel'),
metadata: {
behaviors: [
Behavior.INTERACTIVE_CHART,
Behavior.DRILL_TO_DETAIL,
Behavior.DRILL_BY,
Behavior.InteractiveChart,
Behavior.DrillToDetail,
Behavior.DrillBy,
],
category: t('KPI'),
credits: ['https://echarts.apache.org'],

View File

@@ -54,7 +54,7 @@ export function formatFunnelLabel({
params,
labelType,
numberFormatter,
percentCalculationType = PercentCalcType.FIRST_STEP,
percentCalculationType = PercentCalcType.FirstStep,
sanitizeName = false,
}: {
params: Pick<CallbackDataParams, 'name' | 'value' | 'percent' | 'data'>;
@@ -72,9 +72,9 @@ export function formatFunnelLabel({
};
let percent;
if (percentCalculationType === PercentCalcType.TOTAL) {
if (percentCalculationType === PercentCalcType.Total) {
percent = (totalPercent ?? 0) / 100;
} else if (percentCalculationType === PercentCalcType.PREV_STEP) {
} else if (percentCalculationType === PercentCalcType.PreviousStep) {
percent = prevStepPercent ?? 0;
} else {
percent = firstStepPercent ?? 0;

View File

@@ -82,7 +82,7 @@ export type FunnelChartTransformedProps =
ContextMenuTransformedProps;
export enum PercentCalcType {
TOTAL = 'total',
PREV_STEP = 'prev_step',
FIRST_STEP = 'first_step',
Total = 'total',
PreviousStep = 'prev_step',
FirstStep = 'first_step',
}

View File

@@ -37,9 +37,9 @@ export default class EchartsGaugeChartPlugin extends EchartsChartPlugin<
loadChart: () => import('./EchartsGauge'),
metadata: {
behaviors: [
Behavior.INTERACTIVE_CHART,
Behavior.DRILL_TO_DETAIL,
Behavior.DRILL_BY,
Behavior.InteractiveChart,
Behavior.DrillToDetail,
Behavior.DrillBy,
],
category: t('KPI'),
credits: ['https://echarts.apache.org'],

View File

@@ -50,9 +50,9 @@ export default class EchartsGraphChartPlugin extends EchartsChartPlugin {
],
thumbnail,
behaviors: [
Behavior.INTERACTIVE_CHART,
Behavior.DRILL_TO_DETAIL,
Behavior.DRILL_BY,
Behavior.InteractiveChart,
Behavior.DrillToDetail,
Behavior.DrillBy,
],
},
transformProps,

View File

@@ -142,7 +142,7 @@ export default function EchartsMixedTimeseries({
...(eventParams.name ? [eventParams.name] : []),
...(isFirst ? labelMap : labelMapB)[eventParams.seriesName],
];
if (data && xAxis.type === AxisType.time) {
if (data && xAxis.type === AxisType.Time) {
drillToDetailFilters.push({
col:
xAxis.label === DTTM_ALIAS
@@ -155,7 +155,7 @@ export default function EchartsMixedTimeseries({
});
}
[
...(data && xAxis.type === AxisType.category ? [xAxis.label] : []),
...(data && xAxis.type === AxisType.Category ? [xAxis.label] : []),
...(isFirst ? formData.groupby : formData.groupbyB),
].forEach((dimension, i) =>
drillToDetailFilters.push({

View File

@@ -49,9 +49,9 @@ export default class EchartsTimeseriesChartPlugin extends EchartsChartPlugin<
loadChart: () => import('./EchartsMixedTimeseries'),
metadata: {
behaviors: [
Behavior.INTERACTIVE_CHART,
Behavior.DRILL_TO_DETAIL,
Behavior.DRILL_BY,
Behavior.InteractiveChart,
Behavior.DrillToDetail,
Behavior.DrillBy,
],
category: t('Evolution'),
credits: ['https://echarts.apache.org'],

View File

@@ -20,6 +20,7 @@
import { invert } from 'lodash';
import {
AnnotationLayer,
AxisType,
buildCustomFormatters,
CategoricalColorNamespace,
CurrencyFormatter,
@@ -460,11 +461,11 @@ export default function transformProps(
}
const tooltipFormatter =
xAxisDataType === GenericDataType.TEMPORAL
xAxisDataType === GenericDataType.Temporal
? getTooltipTimeFormatter(tooltipTimeFormat)
: String;
const xAxisFormatter =
xAxisDataType === GenericDataType.TEMPORAL
xAxisDataType === GenericDataType.Temporal
? getXAxisFormatter(xAxisTimeFormat)
: String;
@@ -503,7 +504,7 @@ export default function transformProps(
},
minorTick: { show: minorTicks },
minInterval:
xAxisType === 'time' && timeGrainSqla
xAxisType === AxisType.Time && timeGrainSqla
? TIMEGRAIN_TO_TIMESTAMP[timeGrainSqla]
: 0,
...getMinAndMaxFromBounds(

View File

@@ -49,9 +49,9 @@ export default class EchartsPieChartPlugin extends EchartsChartPlugin<
loadChart: () => import('./EchartsPie'),
metadata: {
behaviors: [
Behavior.INTERACTIVE_CHART,
Behavior.DRILL_TO_DETAIL,
Behavior.DRILL_BY,
Behavior.InteractiveChart,
Behavior.DrillToDetail,
Behavior.DrillBy,
],
category: t('Part of a Whole'),
credits: ['https://echarts.apache.org'],

View File

@@ -165,7 +165,7 @@ const config: ControlPanelConfig = {
description: t('Further customize how to display each metric'),
renderTrigger: true,
configFormLayout: {
[GenericDataType.NUMERIC]: [[radarMetricMaxValue]],
[GenericDataType.Numeric]: [[radarMetricMaxValue]],
},
shouldMapStateToProps() {
return true;

View File

@@ -48,9 +48,9 @@ export default class EchartsRadarChartPlugin extends EchartsChartPlugin<
loadChart: () => import('./EchartsRadar'),
metadata: {
behaviors: [
Behavior.INTERACTIVE_CHART,
Behavior.DRILL_TO_DETAIL,
Behavior.DRILL_BY,
Behavior.InteractiveChart,
Behavior.DrillToDetail,
Behavior.DrillBy,
],
category: t('Ranking'),
credits: ['https://echarts.apache.org'],

View File

@@ -33,9 +33,9 @@ export default class EchartsSunburstChartPlugin extends EchartsChartPlugin {
loadChart: () => import('./EchartsSunburst'),
metadata: {
behaviors: [
Behavior.INTERACTIVE_CHART,
Behavior.DRILL_TO_DETAIL,
Behavior.DRILL_BY,
Behavior.InteractiveChart,
Behavior.DrillToDetail,
Behavior.DrillBy,
],
category: t('Part of a Whole'),
credits: ['https://echarts.apache.org'],

View File

@@ -45,9 +45,9 @@ export default class EchartsAreaChartPlugin extends EchartsChartPlugin<
loadChart: () => import('../EchartsTimeseries'),
metadata: {
behaviors: [
Behavior.INTERACTIVE_CHART,
Behavior.DRILL_TO_DETAIL,
Behavior.DRILL_BY,
Behavior.InteractiveChart,
Behavior.DrillToDetail,
Behavior.DrillBy,
],
category: t('Evolution'),
credits: ['https://echarts.apache.org'],

View File

@@ -173,7 +173,7 @@ export default function EchartsTimeseries({
...(eventParams.name ? [eventParams.name] : []),
...(labelMap[seriesName] ?? []),
];
if (data && xAxis.type === AxisType.time) {
if (data && xAxis.type === AxisType.Time) {
drillToDetailFilters.push({
col:
// if the xAxis is '__timestamp', granularity_sqla will be the column of filter
@@ -187,7 +187,7 @@ export default function EchartsTimeseries({
});
}
[
...(xAxis.type === AxisType.category && data ? [xAxis.label] : []),
...(xAxis.type === AxisType.Category && data ? [xAxis.label] : []),
...formData.groupby,
].forEach((dimension, i) =>
drillToDetailFilters.push({

View File

@@ -59,9 +59,9 @@ const {
function createAxisTitleControl(axis: 'x' | 'y'): ControlSetRow[] {
const isXAxis = axis === 'x';
const isVertical = (controls: ControlStateMapping) =>
Boolean(controls?.orientation.value === OrientationType.vertical);
Boolean(controls?.orientation.value === OrientationType.Vertical);
const isHorizontal = (controls: ControlStateMapping) =>
Boolean(controls?.orientation.value === OrientationType.horizontal);
Boolean(controls?.orientation.value === OrientationType.Horizontal);
return [
[
{
@@ -148,9 +148,9 @@ function createAxisTitleControl(axis: 'x' | 'y'): ControlSetRow[] {
function createAxisControl(axis: 'x' | 'y'): ControlSetRow[] {
const isXAxis = axis === 'x';
const isVertical = (controls: ControlStateMapping) =>
Boolean(controls?.orientation.value === OrientationType.vertical);
Boolean(controls?.orientation.value === OrientationType.Vertical);
const isHorizontal = (controls: ControlStateMapping) =>
Boolean(controls?.orientation.value === OrientationType.horizontal);
Boolean(controls?.orientation.value === OrientationType.Horizontal);
return [
[
{
@@ -272,8 +272,8 @@ const config: ControlPanelConfig = {
label: t('Bar orientation'),
default: orientation,
options: [
[OrientationType.vertical, t('Vertical')],
[OrientationType.horizontal, t('Horizontal')],
[OrientationType.Vertical, t('Vertical')],
[OrientationType.Horizontal, t('Horizontal')],
],
description: t('Orientation of bar chart'),
},

View File

@@ -51,9 +51,9 @@ export default class EchartsTimeseriesBarChartPlugin extends EchartsChartPlugin<
loadChart: () => import('../../EchartsTimeseries'),
metadata: {
behaviors: [
Behavior.INTERACTIVE_CHART,
Behavior.DRILL_TO_DETAIL,
Behavior.DRILL_BY,
Behavior.InteractiveChart,
Behavior.DrillToDetail,
Behavior.DrillBy,
],
category: t('Evolution'),
credits: ['https://echarts.apache.org'],

View File

@@ -50,9 +50,9 @@ export default class EchartsTimeseriesLineChartPlugin extends EchartsChartPlugin
loadChart: () => import('../../EchartsTimeseries'),
metadata: {
behaviors: [
Behavior.INTERACTIVE_CHART,
Behavior.DRILL_TO_DETAIL,
Behavior.DRILL_BY,
Behavior.InteractiveChart,
Behavior.DrillToDetail,
Behavior.DrillBy,
],
category: t('Evolution'),
credits: ['https://echarts.apache.org'],

View File

@@ -49,9 +49,9 @@ export default class EchartsTimeseriesScatterChartPlugin extends EchartsChartPlu
loadChart: () => import('../../EchartsTimeseries'),
metadata: {
behaviors: [
Behavior.INTERACTIVE_CHART,
Behavior.DRILL_TO_DETAIL,
Behavior.DRILL_BY,
Behavior.InteractiveChart,
Behavior.DrillToDetail,
Behavior.DrillBy,
],
category: t('Evolution'),
credits: ['https://echarts.apache.org'],

View File

@@ -49,9 +49,9 @@ export default class EchartsTimeseriesSmoothLineChartPlugin extends EchartsChart
loadChart: () => import('../../EchartsTimeseries'),
metadata: {
behaviors: [
Behavior.INTERACTIVE_CHART,
Behavior.DRILL_TO_DETAIL,
Behavior.DRILL_BY,
Behavior.InteractiveChart,
Behavior.DrillToDetail,
Behavior.DrillBy,
],
category: t('Evolution'),
credits: ['https://echarts.apache.org'],

View File

@@ -40,9 +40,9 @@ export default class EchartsTimeseriesStepChartPlugin extends EchartsChartPlugin
loadChart: () => import('../EchartsTimeseries'),
metadata: {
behaviors: [
Behavior.INTERACTIVE_CHART,
Behavior.DRILL_TO_DETAIL,
Behavior.DRILL_BY,
Behavior.InteractiveChart,
Behavior.DrillToDetail,
Behavior.DrillBy,
],
category: t('Evolution'),
credits: ['https://echarts.apache.org'],

View File

@@ -69,7 +69,7 @@ export const DEFAULT_FORM_DATA: EchartsTimeseriesFormData = {
showValue: false,
onlyTotal: false,
percentageThreshold: 0,
orientation: OrientationType.vertical,
orientation: OrientationType.Vertical,
sort_series_type: 'sum',
sort_series_ascending: false,
};

View File

@@ -39,9 +39,9 @@ export default class EchartsTimeseriesChartPlugin extends EchartsChartPlugin<
loadChart: () => import('./EchartsTimeseries'),
metadata: {
behaviors: [
Behavior.INTERACTIVE_CHART,
Behavior.DRILL_TO_DETAIL,
Behavior.DRILL_BY,
Behavior.InteractiveChart,
Behavior.DrillToDetail,
Behavior.DrillBy,
],
category: t('Evolution'),
credits: ['https://echarts.apache.org'],

View File

@@ -204,7 +204,7 @@ export default function transformProps(
) {
xAxisLabel = verboseMap[xAxisLabel];
}
const isHorizontal = orientation === OrientationType.horizontal;
const isHorizontal = orientation === OrientationType.Horizontal;
const { totalStackedValues, thresholdValues } = extractDataTotalValues(
rebasedData,
{
@@ -410,11 +410,11 @@ export default function transformProps(
}
const tooltipFormatter =
xAxisDataType === GenericDataType.TEMPORAL
xAxisDataType === GenericDataType.Temporal
? getTooltipTimeFormatter(tooltipTimeFormat)
: String;
const xAxisFormatter =
xAxisDataType === GenericDataType.TEMPORAL
xAxisDataType === GenericDataType.Temporal
? getXAxisFormatter(xAxisTimeFormat)
: String;
@@ -461,7 +461,7 @@ export default function transformProps(
},
minorTick: { show: minorTicks },
minInterval:
xAxisType === AxisType.time && timeGrainSqla
xAxisType === AxisType.Time && timeGrainSqla
? TIMEGRAIN_TO_TIMESTAMP[timeGrainSqla]
: 0,
...getMinAndMaxFromBounds(
@@ -475,7 +475,7 @@ export default function transformProps(
let yAxis: any = {
...defaultYAxis,
type: logAxis ? AxisType.log : AxisType.value,
type: logAxis ? AxisType.Log : AxisType.Value,
min: yAxisMin,
max: yAxisMax,
minorTick: { show: minorTicks },

View File

@@ -38,8 +38,8 @@ import {
} from '../types';
export enum OrientationType {
vertical = 'vertical',
horizontal = 'horizontal',
Vertical = 'vertical',
Horizontal = 'horizontal',
}
export enum EchartsTimeseriesSeriesType {

View File

@@ -48,9 +48,9 @@ export default class EchartsTreemapChartPlugin extends EchartsChartPlugin<
loadChart: () => import('./EchartsTreemap'),
metadata: {
behaviors: [
Behavior.INTERACTIVE_CHART,
Behavior.DRILL_TO_DETAIL,
Behavior.DRILL_BY,
Behavior.InteractiveChart,
Behavior.DrillToDetail,
Behavior.DrillBy,
],
category: t('Part of a Whole'),
credits: ['https://echarts.apache.org'],

View File

@@ -47,7 +47,7 @@ export default class EchartsWaterfallChartPlugin extends ChartPlugin<
controlPanel,
loadChart: () => import('./EchartsWaterfall'),
metadata: new ChartMetadata({
behaviors: [Behavior.INTERACTIVE_CHART],
behaviors: [Behavior.InteractiveChart],
credits: ['https://echarts.apache.org'],
category: t('Evolution'),
description: t(

View File

@@ -339,7 +339,7 @@ export default function transformProps(
if (value === TOTAL_MARK) {
return TOTAL_MARK;
}
if (coltypeMapping[xAxisColumns[index]] === GenericDataType.TEMPORAL) {
if (coltypeMapping[xAxisColumns[index]] === GenericDataType.Temporal) {
if (typeof value === 'string') {
return getTimeFormatter(xAxisTimeFormat)(Number.parseInt(value, 10));
}

View File

@@ -25,13 +25,13 @@ import {
AnnotationLayer,
AnnotationOpacity,
AnnotationType,
AxisType,
DataRecord,
evalExpression,
FormulaAnnotationLayer,
isRecordAnnotationResult,
isTableAnnotationLayer,
isTimeseriesAnnotationResult,
AxisType,
} from '@superset-ui/core';
import { EchartsTimeseriesChartProps } from '../types';
import { EchartsMixedTimeseriesProps } from '../MixedTimeseries/types';
@@ -46,7 +46,7 @@ export function evalFormula(
return data.map(row => {
let value = row[xAxis];
if (xAxisType === 'time') {
if (xAxisType === AxisType.Time) {
value = new Date(value as string).getTime();
}
return [value, evalExpression(expression, (value || 0) as number)];

View File

@@ -364,7 +364,7 @@ export function formatSeriesName(
if (typeof name === 'boolean') {
return name.toString();
}
if (name instanceof Date || coltype === GenericDataType.TEMPORAL) {
if (name instanceof Date || coltype === GenericDataType.Temporal) {
const normalizedName =
typeof name === 'string' ? normalizeTimestamp(name) : name;
const d =
@@ -535,15 +535,15 @@ export function getAxisType(
dataType?: GenericDataType,
): AxisType {
if (forceCategorical) {
return AxisType.category;
return AxisType.Category;
}
if (dataType === GenericDataType.TEMPORAL) {
return AxisType.time;
if (dataType === GenericDataType.Temporal) {
return AxisType.Time;
}
if (dataType === GenericDataType.NUMERIC && !stack) {
return AxisType.value;
if (dataType === GenericDataType.Numeric && !stack) {
return AxisType.Value;
}
return AxisType.category;
return AxisType.Category;
}
export function getOverMaxHiddenFormatter(
@@ -585,7 +585,7 @@ export function getMinAndMaxFromBounds(
max?: number,
seriesType?: EchartsTimeseriesSeriesType,
): BoundsType | {} {
if (axisType === AxisType.value && truncateAxis) {
if (axisType === AxisType.Value && truncateAxis) {
const ret: BoundsType = {};
if (seriesType === EchartsTimeseriesSeriesType.Bar) {
ret.scale = true;

View File

@@ -93,7 +93,7 @@ describe('formatFunnelLabel', () => {
params,
numberFormatter,
labelType: EchartsFunnelLabelTypeType.Key,
percentCalculationType: PercentCalcType.TOTAL,
percentCalculationType: PercentCalcType.Total,
}),
).toEqual('My Label');
expect(
@@ -101,7 +101,7 @@ describe('formatFunnelLabel', () => {
params,
numberFormatter,
labelType: EchartsFunnelLabelTypeType.Value,
percentCalculationType: PercentCalcType.TOTAL,
percentCalculationType: PercentCalcType.Total,
}),
).toEqual('1.23k');
expect(
@@ -109,7 +109,7 @@ describe('formatFunnelLabel', () => {
params,
numberFormatter,
labelType: EchartsFunnelLabelTypeType.Percent,
percentCalculationType: PercentCalcType.TOTAL,
percentCalculationType: PercentCalcType.Total,
}),
).toEqual('12.34%');
expect(
@@ -117,7 +117,7 @@ describe('formatFunnelLabel', () => {
params,
numberFormatter,
labelType: EchartsFunnelLabelTypeType.Percent,
percentCalculationType: PercentCalcType.FIRST_STEP,
percentCalculationType: PercentCalcType.FirstStep,
}),
).toEqual('50.00%');
expect(
@@ -125,7 +125,7 @@ describe('formatFunnelLabel', () => {
params,
numberFormatter,
labelType: EchartsFunnelLabelTypeType.Percent,
percentCalculationType: PercentCalcType.PREV_STEP,
percentCalculationType: PercentCalcType.PreviousStep,
}),
).toEqual('85.00%');
expect(
@@ -133,7 +133,7 @@ describe('formatFunnelLabel', () => {
params,
numberFormatter,
labelType: EchartsFunnelLabelTypeType.KeyValue,
percentCalculationType: PercentCalcType.TOTAL,
percentCalculationType: PercentCalcType.Total,
}),
).toEqual('My Label: 1.23k');
expect(
@@ -141,7 +141,7 @@ describe('formatFunnelLabel', () => {
params,
numberFormatter,
labelType: EchartsFunnelLabelTypeType.KeyPercent,
percentCalculationType: PercentCalcType.TOTAL,
percentCalculationType: PercentCalcType.Total,
}),
).toEqual('My Label: 12.34%');
expect(
@@ -149,7 +149,7 @@ describe('formatFunnelLabel', () => {
params,
numberFormatter,
labelType: EchartsFunnelLabelTypeType.KeyValuePercent,
percentCalculationType: PercentCalcType.TOTAL,
percentCalculationType: PercentCalcType.Total,
}),
).toEqual('My Label: 1.23k (12.34%)');
expect(
@@ -157,7 +157,7 @@ describe('formatFunnelLabel', () => {
params: { ...params, name: '<NULL>' },
numberFormatter,
labelType: EchartsFunnelLabelTypeType.Key,
percentCalculationType: PercentCalcType.TOTAL,
percentCalculationType: PercentCalcType.Total,
}),
).toEqual('<NULL>');
expect(
@@ -165,7 +165,7 @@ describe('formatFunnelLabel', () => {
params: { ...params, name: '<NULL>' },
numberFormatter,
labelType: EchartsFunnelLabelTypeType.Key,
percentCalculationType: PercentCalcType.TOTAL,
percentCalculationType: PercentCalcType.Total,
sanitizeName: true,
}),
).toEqual('&lt;NULL&gt;');

View File

@@ -161,7 +161,7 @@ describe('evalFormula', () => {
{ __timestamp: 10 },
];
expect(evalFormula(layer, data, '__timestamp', AxisType.time)).toEqual([
expect(evalFormula(layer, data, '__timestamp', AxisType.Time)).toEqual([
[0, 1],
[10, 11],
]);
@@ -178,7 +178,7 @@ describe('evalFormula', () => {
{ ...layer, value: 'y = x* 2 -1' },
data,
'__timestamp',
AxisType.time,
AxisType.Time,
),
).toEqual([
[0, -1],
@@ -194,7 +194,7 @@ describe('evalFormula', () => {
{ ...layer, value: 'y = 1000' },
data,
'gender',
AxisType.category,
AxisType.Category,
),
).toEqual([
['boy', 1000],

View File

@@ -645,7 +645,7 @@ describe('formatSeriesName', () => {
expect(
formatSeriesName('1995-01-01 00:00:00.000000', {
timeFormatter: annualTimeFormatter,
coltype: GenericDataType.TEMPORAL,
coltype: GenericDataType.Temporal,
}),
).toEqual('1995');
});
@@ -911,33 +911,33 @@ test('calculateLowerLogTick', () => {
});
test('getAxisType without forced categorical', () => {
expect(getAxisType(false, false, GenericDataType.TEMPORAL)).toEqual(
AxisType.time,
expect(getAxisType(false, false, GenericDataType.Temporal)).toEqual(
AxisType.Time,
);
expect(getAxisType(false, false, GenericDataType.NUMERIC)).toEqual(
AxisType.value,
expect(getAxisType(false, false, GenericDataType.Numeric)).toEqual(
AxisType.Value,
);
expect(getAxisType(true, false, GenericDataType.NUMERIC)).toEqual(
AxisType.category,
expect(getAxisType(true, false, GenericDataType.Numeric)).toEqual(
AxisType.Category,
);
expect(getAxisType(false, false, GenericDataType.BOOLEAN)).toEqual(
AxisType.category,
expect(getAxisType(false, false, GenericDataType.Boolean)).toEqual(
AxisType.Category,
);
expect(getAxisType(false, false, GenericDataType.STRING)).toEqual(
AxisType.category,
expect(getAxisType(false, false, GenericDataType.String)).toEqual(
AxisType.Category,
);
});
test('getAxisType with forced categorical', () => {
expect(getAxisType(false, true, GenericDataType.NUMERIC)).toEqual(
AxisType.category,
expect(getAxisType(false, true, GenericDataType.Numeric)).toEqual(
AxisType.Category,
);
});
test('getMinAndMaxFromBounds returns empty object when not truncating', () => {
expect(
getMinAndMaxFromBounds(
AxisType.value,
AxisType.Value,
false,
10,
100,
@@ -949,7 +949,7 @@ test('getMinAndMaxFromBounds returns empty object when not truncating', () => {
test('getMinAndMaxFromBounds returns empty object for categorical axis', () => {
expect(
getMinAndMaxFromBounds(
AxisType.category,
AxisType.Category,
false,
10,
100,
@@ -961,7 +961,7 @@ test('getMinAndMaxFromBounds returns empty object for categorical axis', () => {
test('getMinAndMaxFromBounds returns empty object for time axis', () => {
expect(
getMinAndMaxFromBounds(
AxisType.time,
AxisType.Time,
false,
10,
100,
@@ -973,7 +973,7 @@ test('getMinAndMaxFromBounds returns empty object for time axis', () => {
test('getMinAndMaxFromBounds returns dataMin/dataMax for non-bar charts', () => {
expect(
getMinAndMaxFromBounds(
AxisType.value,
AxisType.Value,
true,
undefined,
undefined,
@@ -988,7 +988,7 @@ test('getMinAndMaxFromBounds returns dataMin/dataMax for non-bar charts', () =>
test('getMinAndMaxFromBounds returns bound without scale for non-bar charts', () => {
expect(
getMinAndMaxFromBounds(
AxisType.value,
AxisType.Value,
true,
10,
undefined,
@@ -1003,7 +1003,7 @@ test('getMinAndMaxFromBounds returns bound without scale for non-bar charts', ()
test('getMinAndMaxFromBounds returns scale when truncating without bounds', () => {
expect(
getMinAndMaxFromBounds(
AxisType.value,
AxisType.Value,
true,
undefined,
undefined,
@@ -1015,7 +1015,7 @@ test('getMinAndMaxFromBounds returns scale when truncating without bounds', () =
test('getMinAndMaxFromBounds returns automatic upper bound when truncating', () => {
expect(
getMinAndMaxFromBounds(
AxisType.value,
AxisType.Value,
true,
10,
undefined,
@@ -1030,7 +1030,7 @@ test('getMinAndMaxFromBounds returns automatic upper bound when truncating', ()
test('getMinAndMaxFromBounds returns automatic lower bound when truncating', () => {
expect(
getMinAndMaxFromBounds(
AxisType.value,
AxisType.Value,
true,
undefined,
100,