fix(explore): temporal column mixin (#28241)

This commit is contained in:
JUST.in DO IT 2024-04-29 10:01:05 -07:00 committed by GitHub
parent c975f97ce8
commit 743c0bde7e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 3 deletions

View File

@ -23,7 +23,12 @@ import {
t,
validateNonEmpty,
} from '@superset-ui/core';
import { BaseControlConfig, ControlPanelState, ControlState } from '../types';
import {
BaseControlConfig,
ControlPanelState,
ControlState,
ExtraControlProps,
} from '../types';
import { getTemporalColumns } from '../utils';
const getAxisLabel = (
@ -52,14 +57,15 @@ export const xAxisMixin = {
default: undefined,
};
export const temporalColumnMixin: Pick<BaseControlConfig, 'mapStateToProps'> = {
export const temporalColumnMixin: Pick<BaseControlConfig, 'mapStateToProps'> &
Partial<ExtraControlProps> = {
isTemporal: true,
mapStateToProps: ({ datasource }) => {
const payload = getTemporalColumns(datasource);
return {
options: payload.temporalColumns,
default: payload.defaultTemporalColumn,
isTemporal: true,
};
},
};