Skip to content

Commit

Permalink
fix: import type directly from vchart
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoluoHe committed Jul 24, 2024
1 parent 6e4c0e5 commit 2964e50
Show file tree
Hide file tree
Showing 43 changed files with 63 additions and 66 deletions.
16 changes: 8 additions & 8 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ export const horizontalFunnelSpec = {
visible: true,
style: {
lineHeight: 16,
limit: (datum, ctx) => Math.abs(ctx.getPoints(datum)[0].x - ctx.getPoints(datum)[3].x),
text: datum => `${datum.percent * 100}%`,
x: (datum, ctx) => ctx.getPoints(datum)[0].x + 10,
y: (datum, ctx) => ctx.getPoints(datum)[0].y - 10,
limit: (datum: any, ctx: any) => Math.abs(ctx.getPoints(datum)[0].x - ctx.getPoints(datum)[3].x),
text: (datum: any) => `${datum.percent * 100}%`,
x: (datum: any, ctx: any) => ctx.getPoints(datum)[0].x + 10,
y: (datum: any, ctx: any) => ctx.getPoints(datum)[0].y - 10,
textAlign: 'left',
textBaseline: 'bottom',
fontSize: 20,
Expand All @@ -67,7 +67,7 @@ export const horizontalFunnelSpec = {
type: 'polygon',
dataId: 'funnel',
style: {
points: (datum, ctx) => {
points: (datum: any, ctx: any) => {
const start = ctx.getPoints(datum)[1];
const end = { x: start.x, y: 0 };
return [start, end];
Expand All @@ -81,7 +81,7 @@ export const horizontalFunnelSpec = {
type: 'text',
dataId: 'funnel',
style: {
text: (datum, ctx) => {
text: (datum: any, ctx: any) => {
return {
type: 'rich',
text: [
Expand All @@ -101,8 +101,8 @@ export const horizontalFunnelSpec = {
]
};
},
x: (datum, ctx) => ctx.getPoints(datum)[0].x + 10,
width: (datum, ctx) => {
x: (datum: any, ctx: any) => ctx.getPoints(datum)[0].x + 10,
width: (datum: any, ctx: any) => {
return ctx.getPoints(datum)[3].x - ctx.getPoints(datum)[0].x;
},
textAlign: 'left',
Expand All @@ -119,7 +119,7 @@ export const horizontalFunnelSpec = {
style: {
image:
'https://sf16-scmcdn-sg.ibytedtos.com/obj/static-sg/visactor-site/sg/client/img/visactor/vrender-icon.svg',
x: (datum, ctx) =>
x: (datum: any, ctx: any) =>
ctx.getPoints(datum)[2].x + (ctx.getPoints(datum)[2].x - ctx.getPoints(datum)[1].x) * 0.5 - 36,
y: 10,
align: 'right',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export function Charts(props: IProps) {
...chart.spec,
height: chartHeight
}}
// @ts-ignore
options={{
...chart.option,
mode: isMobile ? 'mobile-browser' : 'desktop-browser'
Expand Down
2 changes: 1 addition & 1 deletion packages/vchart-theme-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@types/jest": "~29.5.0",
"@rushstack/eslint-patch": "~1.1.4",
"@visactor/vchart": "1.11.6",
"@visactor/vchart-types": "1.11.0",
"@visactor/vchart-types": "1.11.6",
"eslint": "~8.18.0",
"vite": "^4.5.0",
"typescript": "4.9.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/vchart-theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@types/jest": "~29.5.0",
"@rushstack/eslint-patch": "~1.1.4",
"@visactor/vchart": "1.11.6",
"@visactor/vchart-types": "1.11.0",
"@visactor/vchart-types": "1.11.6",
"eslint": "~8.18.0",
"vite": "^4.5.0",
"typescript": "4.9.5",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IDataZoomTheme } from '@visactor/vchart-types';
import type { IDataZoomTheme } from '@visactor/vchart';

export const dataZoom: IDataZoomTheme = {
height: 44,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IPolarAxisCommonTheme } from '@visactor/vchart-types';
import type { IPolarAxisCommonTheme } from '@visactor/vchart';

const axisRadius: IPolarAxisCommonTheme = {
domainLine: {},
Expand Down
2 changes: 1 addition & 1 deletion packages/vchart-theme/src/legacy/legend/color-legend.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IColorLegendTheme, IContinuousLegendTheme } from '@visactor/vchart-types';
import type { IColorLegendTheme, IContinuousLegendTheme } from '@visactor/vchart';
import { DEFAULT_CONTINUOUS_LEGEND_THEME } from './continuous';

const handlerTheme: IContinuousLegendTheme['handler'] = {
Expand Down
2 changes: 1 addition & 1 deletion packages/vchart-theme/src/legacy/legend/continuous.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IContinuousLegendTheme } from '@visactor/vchart-types';
import type { IContinuousLegendTheme } from '@visactor/vchart';

export const DEFAULT_CONTINUOUS_LEGEND_THEME: IContinuousLegendTheme = {
orient: 'right',
Expand Down
2 changes: 1 addition & 1 deletion packages/vchart-theme/src/legacy/legend/size-legend.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// eslint-disable-next-line no-duplicate-imports
import type { IContinuousLegendTheme, ISizeLegendTheme } from '@visactor/vchart-types';
import type { IContinuousLegendTheme, ISizeLegendTheme } from '@visactor/vchart';
import { DEFAULT_CONTINUOUS_LEGEND_THEME } from './continuous';

const getHandlerTheme = (align?: 'top' | 'bottom' | 'left' | 'right'): IContinuousLegendTheme['handler'] => ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IBandAxisTheme } from '@visactor/vchart-types';
import type { IBandAxisTheme } from '@visactor/vchart';

export const axisBand: IBandAxisTheme = {
domainLine: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ICartesianAxisCommonTheme } from '@visactor/vchart-types';
import type { ICartesianAxisCommonTheme } from '@visactor/vchart';

export const axisX: ICartesianAxisCommonTheme = {
label: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IAxisCommonTheme } from '@visactor/vchart-types';
import type { IAxisCommonTheme } from '@visactor/vchart';

export const commonAxis: IAxisCommonTheme = {
domainLine: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IAxisCommonTheme } from '@visactor/vchart-types';
import type { IAxisCommonTheme } from '@visactor/vchart';

export const axisLinear: IAxisCommonTheme = {
domainLine: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IPolarAxisCommonTheme } from '@visactor/vchart-types';
import type { IPolarAxisCommonTheme } from '@visactor/vchart';

export const axisRadius: IPolarAxisCommonTheme = {
grid: {
Expand Down
16 changes: 6 additions & 10 deletions packages/vchart-theme/src/mobile/common/component/crosshair.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import type { ICrosshairTheme } from '@visactor/vchart-types';
import type {
ICrosshairCategoryFieldSpec,
ICrosshairLabelSpec,
ICrosshairValueFieldSpec
} from '@visactor/vchart-types/types/component/crosshair';
import type { ICrosshairTheme } from '@visactor/vchart';
import type { ICrosshairLabelSpec } from '@visactor/vchart-types/types/component/crosshair';

const getLabelSpec = (): ICrosshairLabelSpec => ({
visible: false,
Expand All @@ -17,14 +13,14 @@ const getLabelSpec = (): ICrosshairLabelSpec => ({
}
});

const getBandField = (): ICrosshairCategoryFieldSpec => ({
const getBandField = (): ICrosshairTheme['bandField'] => ({
visible: false,
label: getLabelSpec()
label: getLabelSpec() as any
});

const getLinearField = (): ICrosshairValueFieldSpec => ({
const getLinearField = (): ICrosshairTheme['linearField'] => ({
visible: false,
label: getLabelSpec()
label: getLabelSpec() as any
});

export const crosshair: ICrosshairTheme = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IDataZoomTheme } from '@visactor/vchart-types';
import type { IDataZoomTheme } from '@visactor/vchart';

export const dataZoom: IDataZoomTheme = {
padding: [12, 0],
Expand Down
2 changes: 1 addition & 1 deletion packages/vchart-theme/src/mobile/common/component/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IComponentTheme } from '@visactor/vchart-types';
import type { IComponentTheme } from '@visactor/vchart';
import { axisBand } from './axis/band-axis';
import { axisX, axisY, axisZ } from './axis/cartesian-axis';
import { commonAxis } from './axis/common-axis';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IIndicatorTheme } from '@visactor/vchart-types';
import type { IIndicatorTheme } from '@visactor/vchart';

export const indicator: IIndicatorTheme = {
title: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IColorLegendTheme } from '@visactor/vchart-types';
import type { IColorLegendTheme } from '@visactor/vchart';
import { DEFAULT_CONTINUOUS_LEGEND_THEME } from './continuous';

export const colorLegend: IColorLegendTheme = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IContinuousLegendTheme } from '@visactor/vchart-types';
import type { IContinuousLegendTheme } from '@visactor/vchart';

export const DEFAULT_CONTINUOUS_LEGEND_THEME: IContinuousLegendTheme = {
orient: 'right',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IDiscreteLegendTheme } from '@visactor/vchart-types';
import type { IDiscreteLegendTheme } from '@visactor/vchart';

export const discreteLegend: IDiscreteLegendTheme = {
orient: 'top',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ISizeLegendTheme } from '@visactor/vchart-types';
import type { ISizeLegendTheme } from '@visactor/vchart';
import { DEFAULT_CONTINUOUS_LEGEND_THEME } from './continuous';

export const sizeLegend: ISizeLegendTheme = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IMapLabelTheme } from '@visactor/vchart-types';
import type { IMapLabelTheme } from '@visactor/vchart';

export const mapLabel: IMapLabelTheme = {
visible: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IMarkAreaTheme } from '@visactor/vchart-types';
import type { IMarkAreaTheme } from '@visactor/vchart';

export const markArea: IMarkAreaTheme = {
label: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IMarkLineTheme } from '@visactor/vchart-types';
import type { IMarkLineTheme } from '@visactor/vchart';

export const markLine: IMarkLineTheme = {
startSymbol: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IMarkPointTheme } from '@visactor/vchart-types';
import type { IMarkPointTheme } from '@visactor/vchart';

export const markPoint: IMarkPointTheme = {
itemLine: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IPlayerTheme } from '@visactor/vchart-types';
import type { IPlayerTheme } from '@visactor/vchart';

export const player: IPlayerTheme = {
visible: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IPoptipTheme } from '@visactor/vchart-types';
import type { IPoptipTheme } from '@visactor/vchart';

export const poptip: IPoptipTheme = {
visible: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/vchart-theme/src/mobile/common/component/title.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ITitleTheme } from '@visactor/vchart-types';
import type { ITitleTheme } from '@visactor/vchart';

export const title: ITitleTheme = {
padding: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ITooltipTheme } from '@visactor/vchart-types';
import type { ITooltipTheme } from '@visactor/vchart';

export const tooltip: ITooltipTheme = {
offset: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ITotalLabelTheme } from '@visactor/vchart-types';
import type { ITotalLabelTheme } from '@visactor/vchart';

export const totalLabel: ITotalLabelTheme = {
visible: false,
Expand Down
2 changes: 1 addition & 1 deletion packages/vchart-theme/src/mobile/common/mark.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IGlobalMarkThemeByName, IGlobalMarkThemeByType } from '@visactor/vchart-types';
import type { IGlobalMarkThemeByName, IGlobalMarkThemeByType } from '@visactor/vchart';

export const markByType: IGlobalMarkThemeByType = {
text: {
Expand Down
2 changes: 1 addition & 1 deletion packages/vchart-theme/src/theme-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const allThemeMap = new Map([
// 移动端主题
[mobileLightTheme.name, mobileLightTheme],
[mobileDarkTheme.name, mobileDarkTheme],
// 传统主题
// // 传统主题
[legacyLightTheme.name, legacyLightTheme],
[legacyDarkTheme.name, legacyDarkTheme],
// 大屏主题
Expand Down
2 changes: 1 addition & 1 deletion packages/vchart-theme/src/v-screen/common/color-scheme.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IThemeColorScheme } from '@visactor/vchart-types';
import type { IThemeColorScheme } from '@visactor/vchart';
import { palette } from './palette';

export const getColorScheme = (dataScheme: string[]): IThemeColorScheme => ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IComponentTheme } from '@visactor/vchart-types';
import type { IComponentTheme } from '@visactor/vchart';

export const axis: Pick<
IComponentTheme,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ICrosshairTheme } from '@visactor/vchart-types';
import type { ICrosshairTheme } from '@visactor/vchart';

export const crosshair: ICrosshairTheme = {
bandField: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ITooltipTheme } from '@visactor/vchart-types';
import type { ITooltipTheme } from '@visactor/vchart';

export const tooltip: ITooltipTheme = {
panel: {
Expand Down
2 changes: 1 addition & 1 deletion packages/vchart-theme/src/v-screen/common/mark.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import type { IGlobalMarkThemeByName } from '@visactor/vchart-types';
import type { IGlobalMarkThemeByName } from '@visactor/vchart';

export const markByName: IGlobalMarkThemeByName = {};
2 changes: 1 addition & 1 deletion packages/vchart-theme/src/v-screen/common/palette.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { BuiltinColorPalette } from '@visactor/vchart-types';
import type { BuiltinColorPalette } from '@visactor/vchart';

export const palette: Partial<BuiltinColorPalette> = {
/** 背景色 */
Expand Down
2 changes: 1 addition & 1 deletion packages/vchart-theme/src/v-screen/common/series/area.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ISeriesTheme, SeriesTypeEnum, SeriesTypeForThemeEnum } from '@visactor/vchart-types';
import type { ISeriesTheme, SeriesTypeEnum, SeriesTypeForThemeEnum } from '@visactor/vchart';

export const area: Pick<
ISeriesTheme,
Expand Down
2 changes: 1 addition & 1 deletion packages/vchart-theme/src/v-screen/common/series/bar.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ISeriesTheme, SeriesTypeEnum, SeriesTypeForThemeEnum } from '@visactor/vchart-types';
import type { ISeriesTheme, SeriesTypeEnum, SeriesTypeForThemeEnum } from '@visactor/vchart';

export const bar: Pick<
ISeriesTheme,
Expand Down
Loading

0 comments on commit 2964e50

Please sign in to comment.