Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(type): export EChartsInitOpts and some Payload types for echarts/core #19103

Merged
merged 2 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core/echarts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ type ECEventDefinition = {
// TODO: Use ECActionEvent
[key: string]: (...args: unknown[]) => void | boolean
};
type EChartsInitOpts = {
export type EChartsInitOpts = {
locale?: string | LocaleOption,
renderer?: RendererType,
devicePixelRatio?: number,
Expand Down
43 changes: 25 additions & 18 deletions src/export/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,23 @@ import { use } from '../extension';

// Import label layout by default.
// TODO will be treeshaked.
import {installLabelLayout} from '../label/installLabelLayout';
import { installLabelLayout } from '../label/installLabelLayout';
use(installLabelLayout);


// Export necessary types
export {ZRColor as Color, Payload, ECElementEvent} from '../util/types';
export {LinearGradientObject} from 'zrender/src/graphic/LinearGradient';
export {RadialGradientObject} from 'zrender/src/graphic/RadialGradient';
export {PatternObject, ImagePatternObject, SVGPatternObject} from 'zrender/src/graphic/Pattern';
export {ElementEvent} from 'zrender/src/Element';
export {
ZRColor as Color,
Payload,
ECElementEvent,
HighlightPayload,
DownplayPayload,
SelectChangedPayload
} from '../util/types';
export { LinearGradientObject } from 'zrender/src/graphic/LinearGradient';
export { RadialGradientObject } from 'zrender/src/graphic/RadialGradient';
export { PatternObject, ImagePatternObject, SVGPatternObject } from 'zrender/src/graphic/Pattern';
export { ElementEvent } from 'zrender/src/Element';

// ComposeOption
import type { ComponentOption, ECBasicOption as EChartsCoreOption } from '../util/types';
Expand All @@ -45,9 +52,9 @@ import type { AngleAxisOption, RadiusAxisOption } from '../coord/polar/AxisModel
import type { ParallelAxisOption } from '../coord/parallel/AxisModel';


export {EChartsType as ECharts} from '../core/echarts';
export { EChartsType as ECharts } from '../core/echarts';

export {EChartsCoreOption};
export { EChartsCoreOption };

// type SeriesSubComponentsTypes = 'markPoint' | 'markLine' | 'markArea' | 'tooltip';
// type InjectSeriesSubComponents<OptionUnion extends ComponentOption, Injected> =
Expand Down Expand Up @@ -92,16 +99,16 @@ type ComposeUnitOption<OptionUnion extends ComponentOption> =
Omit<EChartsCoreOption, 'baseOption' | 'options'> & {
[key in GetMainType<OptionUnion>]?: Arrayable<
ExtractComponentOption<OptionUnion, key>
// TODO: It will make error log too complex.
// So this more strict type checking will not be used currently to make sure the error msg is friendly.
//
// Inject markPoint, markLine, markArea, tooltip in series.
// ExtractComponentOption<
// InjectSeriesSubComponents<
// OptionUnion, GetSeriesInjectedSubOption<GetMainType<OptionUnion>, OptionUnion>
// >,
// key
// >
// TODO: It will make error log too complex.
// So this more strict type checking will not be used currently to make sure the error msg is friendly.
//
// Inject markPoint, markLine, markArea, tooltip in series.
// ExtractComponentOption<
// InjectSeriesSubComponents<
// OptionUnion, GetSeriesInjectedSubOption<GetMainType<OptionUnion>, OptionUnion>
// >,
// key
// >
>
} & GetDependencies<GetMainType<OptionUnion>>;

Expand Down