Skip to content

Commit

Permalink
fix(explore): temporal column mixin (apache#28241)
Browse files Browse the repository at this point in the history
  • Loading branch information
justinpark authored Apr 29, 2024
1 parent e39b426 commit 481ce82
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down Expand Up @@ -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,
};
},
};
Expand Down

0 comments on commit 481ce82

Please sign in to comment.