Skip to content

Commit

Permalink
fix(types) Export cbs and their parameter types
Browse files Browse the repository at this point in the history
  • Loading branch information
dougalg committed May 6, 2021
1 parent 5826ca5 commit 9b08a0e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/component/tooltip/TooltipModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
import {AxisPointerOption} from '../axisPointer/AxisPointerModel';


type TopLevelFormatterParams = CallbackDataParams | CallbackDataParams[];
export type TopLevelFormatterParams = CallbackDataParams | CallbackDataParams[];

export interface TooltipOption extends CommonTooltipOption<TopLevelFormatterParams>, ComponentOption {
mainType?: 'tooltip'
Expand Down
2 changes: 1 addition & 1 deletion src/export/all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
// This file is for providing types when import whole module.

export * from './core';
export * from './option';
export * from './option';
35 changes: 32 additions & 3 deletions src/export/option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ import type {ParallelAxisOption as ParallelAxisComponentOption} from '../coord/p
import type {ParallelCoordinateSystemOption as ParallelComponentOption} from '../coord/parallel/ParallelModel';
import type {CalendarOption as CalendarComponentOption} from '../coord/calendar/CalendarModel';
import type {ToolboxOption} from '../component/toolbox/ToolboxModel';
import type {TooltipOption as TooltipComponentOption} from '../component/tooltip/TooltipModel';
import type {
TooltipOption as TooltipComponentOption,
TopLevelFormatterParams
} from '../component/tooltip/TooltipModel';
import type {AxisPointerOption as AxisPointerComponentOption} from '../component/axisPointer/AxisPointerModel';
import type {BrushOption as BrushComponentOption} from '../component/brush/BrushModel';
import type {TitleOption as TitleComponentOption} from '../component/title/install';
Expand Down Expand Up @@ -97,7 +100,20 @@ import type {ToolboxSaveAsImageFeatureOption} from '../component/toolbox/feature
import type {ToolboxFeatureOption} from '../component/toolbox/featureManager';


import type { ECBasicOption, SeriesTooltipOption, AriaOption as AriaComponentOption } from '../util/types';
import type {
ECBasicOption,
SeriesTooltipOption,
AriaOption as AriaComponentOption,
TooltipFormatterCallback,
LabelFormatterCallback,
CallbackDataParams,
AnimationDurationCallback,
AnimationDelayCallback,
AnimationDelayCallbackParam,
LabelLayoutOptionCallbackParams,
LabelLayoutOptionCallback,
PositionCallback
} from '../util/types';

interface ToolboxComponentOption extends ToolboxOption {
feature?: {
Expand Down Expand Up @@ -234,4 +250,17 @@ export interface EChartsOption extends ECBasicOption {

options?: EChartsOption[];
baseOption?: EChartsOption;
}
}

export {
TooltipFormatterCallback as TooltipComponentFormatterCallback,
TopLevelFormatterParams as TooltipComponentFormatterParams,
LabelFormatterCallback,
CallbackDataParams as DefaultLabelFormatterParams,
AnimationDurationCallback,
AnimationDelayCallback,
AnimationDelayCallbackParam as AnimationDelayCallbackParams,
LabelLayoutOptionCallbackParams,
LabelLayoutOptionCallback,
PositionCallback
};
4 changes: 2 additions & 2 deletions src/util/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,7 @@ export interface LabelLayoutOption {
export type LabelLayoutOptionCallback = (params: LabelLayoutOptionCallbackParams) => LabelLayoutOption;


interface TooltipFormatterCallback<T> {
export interface TooltipFormatterCallback<T> {
/**
* For sync callback
* params will be an array on axis trigger.
Expand All @@ -1235,7 +1235,7 @@ type TooltipBoxLayoutOption = Pick<
/**
* Position relative to the hoverred element. Only available when trigger is item.
*/
interface PositionCallback {
export interface PositionCallback {
(
point: [number, number],
/**
Expand Down

0 comments on commit 9b08a0e

Please sign in to comment.