Skip to content

Commit bf772c1

Browse files
committed
fix: compatible with vue 2
1 parent ad88667 commit bf772c1

File tree

32 files changed

+109
-31
lines changed

32 files changed

+109
-31
lines changed

src/plots/area/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { App, defineComponent } from 'vue-demi'
22
import { Area, AreaOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type AreaChartProps = Writeable<
78
Omit<BaseChartProps<AreaOptions>, 'chart'> & AreaOptions
@@ -10,7 +11,7 @@ export type AreaChartProps = Writeable<
1011
const AreaChart = defineComponent<AreaChartProps>({
1112
name: 'AreaChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={Area} {...ctx.attrs} {...props} />
14+
return () => <BaseChart chart={Area} {...mergeAttrs(props, ctx.attrs)} />
1415
},
1516
})
1617

src/plots/bar/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { App, defineComponent } from 'vue-demi'
22
import { Bar, BarOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type BarChartProps = Writeable<
78
Omit<BaseChartProps<BarOptions>, 'chart'> & BarOptions
@@ -10,7 +11,7 @@ export type BarChartProps = Writeable<
1011
const BarChart = defineComponent<BarChartProps>({
1112
name: 'BarChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={Bar} {...ctx.attrs} {...props} />
14+
return () => <BaseChart chart={Bar} {...mergeAttrs(props, ctx.attrs)} />
1415
},
1516
})
1617

src/plots/bidirectional-bar/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { App, defineComponent } from 'vue-demi'
22
import { BidirectionalBar, BidirectionalBarOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type BidirectionalBarChartProps = Writeable<
78
Omit<BaseChartProps<BidirectionalBarOptions>, 'chart'> &
@@ -12,7 +13,7 @@ const BidirectionalBarChart = defineComponent<BidirectionalBarChartProps>({
1213
name: 'BidirectionalBarChart',
1314
setup: (props, ctx) => {
1415
return () => (
15-
<BaseChart chart={BidirectionalBar} {...ctx.attrs} {...props} />
16+
<BaseChart chart={BidirectionalBar} {...mergeAttrs(props, ctx.attrs)} />
1617
)
1718
},
1819
})

src/plots/box/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { App, defineComponent } from 'vue-demi'
22
import { Box, BoxOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type BoxChartProps = Writeable<
78
Omit<BaseChartProps<BoxOptions>, 'chart'> & BoxOptions
@@ -10,7 +11,7 @@ export type BoxChartProps = Writeable<
1011
const BoxChart = defineComponent<BoxChartProps>({
1112
name: 'BoxChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={Box} {...ctx.attrs} {...props} />
14+
return () => <BaseChart chart={Box} {...mergeAttrs(props, ctx.attrs)} />
1415
},
1516
})
1617

src/plots/bullet/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { App, defineComponent } from 'vue-demi'
22
import { Bullet, BulletOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type BulletChartProps = Writeable<
78
Omit<BaseChartProps<BulletOptions>, 'chart'> & BulletOptions
@@ -10,7 +11,7 @@ export type BulletChartProps = Writeable<
1011
const BulletChart = defineComponent<BulletChartProps>({
1112
name: 'BulletChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={Bullet} {...ctx.attrs} {...props} />
14+
return () => <BaseChart chart={Bullet} {...mergeAttrs(props, ctx.attrs)} />
1415
},
1516
})
1617

src/plots/chord/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { App, defineComponent } from 'vue-demi'
22
import { Chord, ChordOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type ChordChartProps = Writeable<
78
Omit<BaseChartProps<ChordOptions>, 'chart'> & ChordOptions
@@ -10,7 +11,7 @@ export type ChordChartProps = Writeable<
1011
const ChordChart = defineComponent<ChordChartProps>({
1112
name: 'ChordChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={Chord} {...ctx.attrs} {...props} />
14+
return () => <BaseChart chart={Chord} {...mergeAttrs(props, ctx.attrs)} />
1415
},
1516
})
1617

src/plots/column/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { defineComponent, App } from 'vue-demi'
22
import { Column, ColumnOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type ColumnChartProps = Writeable<
78
Omit<BaseChartProps<ColumnOptions>, 'chart'> & ColumnOptions
@@ -10,7 +11,7 @@ export type ColumnChartProps = Writeable<
1011
const ColumnChart = defineComponent<ColumnChartProps>({
1112
name: 'ColumnChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={Column} {...ctx.attrs} {...props} />
14+
return () => <BaseChart chart={Column} {...mergeAttrs(props, ctx.attrs)} />
1415
},
1516
})
1617

src/plots/dual-axes/index.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { App, defineComponent } from 'vue-demi'
22
import { DualAxes, DualAxesOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type DualAxesChartProps = Writeable<
78
Omit<BaseChartProps<DualAxesOptions>, 'chart'> & DualAxesOptions
@@ -10,7 +11,9 @@ export type DualAxesChartProps = Writeable<
1011
const DualAxesChart = defineComponent<DualAxesChartProps>({
1112
name: 'DualAxesChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={DualAxes} {...ctx.attrs} {...props} />
14+
return () => (
15+
<BaseChart chart={DualAxes} {...mergeAttrs(props, ctx.attrs)} />
16+
)
1417
},
1518
})
1619

src/plots/funnel/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { defineComponent, App } from 'vue-demi'
22
import { Funnel, FunnelOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type FunnelChartProps = Writeable<
78
Omit<BaseChartProps<FunnelOptions>, 'chart'> & FunnelOptions
@@ -10,7 +11,7 @@ export type FunnelChartProps = Writeable<
1011
const FunnelChart = defineComponent<FunnelChartProps>({
1112
name: 'FunnelChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={Funnel} {...ctx.attrs} {...props} />
14+
return () => <BaseChart chart={Funnel} {...mergeAttrs(props, ctx.attrs)} />
1415
},
1516
})
1617

src/plots/gauge/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { defineComponent, App } from 'vue-demi'
22
import { Gauge, GaugeOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type GaugeChartProps = Writeable<
78
Omit<BaseChartProps<GaugeOptions>, 'chart'> & GaugeOptions
@@ -10,7 +11,7 @@ export type GaugeChartProps = Writeable<
1011
const GaugeChart = defineComponent<GaugeChartProps>({
1112
name: 'GaugeChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={Gauge} {...ctx.attrs} {...props} />
14+
return () => <BaseChart chart={Gauge} {...mergeAttrs(props, ctx.attrs)} />
1415
},
1516
})
1617

src/plots/heatmap/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { defineComponent, App } from 'vue-demi'
22
import { Heatmap, HeatmapOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type HeatmapChartProps = Writeable<
78
Omit<BaseChartProps<HeatmapOptions>, 'chart'> & HeatmapOptions
@@ -10,7 +11,7 @@ export type HeatmapChartProps = Writeable<
1011
const HeatmapChart = defineComponent<HeatmapChartProps>({
1112
name: 'HeatmapChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={Heatmap} {...ctx.attrs} {...props} />
14+
return () => <BaseChart chart={Heatmap} {...mergeAttrs(props, ctx.attrs)} />
1415
},
1516
})
1617

src/plots/histogram/index.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { defineComponent, App } from 'vue-demi'
22
import { Histogram, HistogramOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type HistogramChartProps = Writeable<
78
Omit<BaseChartProps<HistogramOptions>, 'chart'> & HistogramOptions
@@ -10,7 +11,9 @@ export type HistogramChartProps = Writeable<
1011
const HistogramChart = defineComponent<HistogramChartProps>({
1112
name: 'HistogramChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={Histogram} {...ctx.attrs} {...props} />
14+
return () => (
15+
<BaseChart chart={Histogram} {...mergeAttrs(props, ctx.attrs)} />
16+
)
1417
},
1518
})
1619

src/plots/line/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { defineComponent, App } from 'vue-demi'
22
import { Line, LineOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type LineChartProps = Writeable<
78
Omit<BaseChartProps<LineOptions>, 'chart'> & LineOptions
@@ -10,7 +11,7 @@ export type LineChartProps = Writeable<
1011
const LineChart = defineComponent<LineChartProps>({
1112
name: 'LineChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={Line} {...ctx.attrs} {...props} />
14+
return () => <BaseChart chart={Line} {...mergeAttrs(props, ctx.attrs)} />
1415
},
1516
})
1617

src/plots/liquid/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { defineComponent, App } from 'vue-demi'
22
import { Liquid, LiquidOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type LiquidChartProps = Writeable<
78
Omit<BaseChartProps<LiquidOptions>, 'chart'> & LiquidOptions
@@ -10,7 +11,7 @@ export type LiquidChartProps = Writeable<
1011
const LiquidChart = defineComponent<LiquidChartProps>({
1112
name: 'LiquidChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={Liquid} {...ctx.attrs} {...props} />
14+
return () => <BaseChart chart={Liquid} {...mergeAttrs(props, ctx.attrs)} />
1415
},
1516
})
1617

src/plots/multi-view/index.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { App, defineComponent } from 'vue-demi'
22
import { MultiView, MultiViewOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type MultiViewChartProps = Writeable<
78
Omit<BaseChartProps<MultiViewOptions>, 'chart'> & MultiViewOptions
@@ -10,7 +11,9 @@ export type MultiViewChartProps = Writeable<
1011
const MultiViewChart = defineComponent<MultiViewChartProps>({
1112
name: 'MultiViewChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={MultiView} {...ctx.attrs} {...props} />
14+
return () => (
15+
<BaseChart chart={MultiView} {...mergeAttrs(props, ctx.attrs)} />
16+
)
1417
},
1518
})
1619

src/plots/pie/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { defineComponent, App } from 'vue-demi'
22
import { Pie, PieOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type PieChartProps = Writeable<
78
Omit<BaseChartProps<PieOptions>, 'chart'> & PieOptions
@@ -10,7 +11,7 @@ export type PieChartProps = Writeable<
1011
const PieChart = defineComponent<PieChartProps>({
1112
name: 'PieChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={Pie} {...ctx.attrs} {...props} />
14+
return () => <BaseChart chart={Pie} {...mergeAttrs(props, ctx.attrs)} />
1415
},
1516
})
1617

src/plots/progress/index.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { defineComponent, App } from 'vue-demi'
22
import { Progress, ProgressOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type ProgressChartProps = Writeable<
78
Omit<BaseChartProps<ProgressOptions>, 'chart'> & ProgressOptions
@@ -10,7 +11,9 @@ export type ProgressChartProps = Writeable<
1011
const ProgressChart = defineComponent<ProgressChartProps>({
1112
name: 'ProgressChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={Progress} {...ctx.attrs} {...props} />
14+
return () => (
15+
<BaseChart chart={Progress} {...mergeAttrs(props, ctx.attrs)} />
16+
)
1417
},
1518
})
1619

src/plots/radar/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { defineComponent, App } from 'vue-demi'
22
import { Radar, RadarOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type RadarChartProps = Writeable<
78
Omit<BaseChartProps<RadarOptions>, 'chart'> & RadarOptions
@@ -10,7 +11,7 @@ export type RadarChartProps = Writeable<
1011
const RadarChart = defineComponent<RadarChartProps>({
1112
name: 'RadarChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={Radar} {...ctx.attrs} {...props} />
14+
return () => <BaseChart chart={Radar} {...mergeAttrs(props, ctx.attrs)} />
1415
},
1516
})
1617

src/plots/radial-bar/index.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { App, defineComponent } from 'vue-demi'
22
import { RadialBar, RadialBarOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type RadialBarChartProps = Writeable<
78
Omit<BaseChartProps<RadialBarOptions>, 'chart'> & RadialBarOptions
@@ -10,7 +11,9 @@ export type RadialBarChartProps = Writeable<
1011
const RadialBarChart = defineComponent<RadialBarChartProps>({
1112
name: 'RadialBarChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={RadialBar} {...ctx.attrs} {...props} />
14+
return () => (
15+
<BaseChart chart={RadialBar} {...mergeAttrs(props, ctx.attrs)} />
16+
)
1417
},
1518
})
1619

src/plots/ring-progress/index.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { defineComponent, App } from 'vue-demi'
22
import { RingProgress, RingProgressOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type RingProgressChartProps = Writeable<
78
Omit<BaseChartProps<RingProgressOptions>, 'chart'> & RingProgressOptions
@@ -10,7 +11,9 @@ export type RingProgressChartProps = Writeable<
1011
const RingProgressChart = defineComponent<RingProgressChartProps>({
1112
name: 'RingProgressChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={RingProgress} {...ctx.attrs} {...props} />
14+
return () => (
15+
<BaseChart chart={RingProgress} {...mergeAttrs(props, ctx.attrs)} />
16+
)
1417
},
1518
})
1619

src/plots/rose/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { defineComponent, App } from 'vue-demi'
22
import { Rose, RoseOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type RoseChartProps = Writeable<
78
Omit<BaseChartProps<RoseOptions>, 'chart'> & RoseOptions
@@ -10,7 +11,7 @@ export type RoseChartProps = Writeable<
1011
const RoseChart = defineComponent<RoseChartProps>({
1112
name: 'RoseChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={Rose} {...ctx.attrs} {...props} />
14+
return () => <BaseChart chart={Rose} {...mergeAttrs(props, ctx.attrs)} />
1415
},
1516
})
1617

src/plots/sankey/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { App, defineComponent } from 'vue-demi'
22
import { Sankey, SankeyOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type SankeyChartProps = Writeable<
78
Omit<BaseChartProps<SankeyOptions>, 'chart'> & SankeyOptions
@@ -10,7 +11,7 @@ export type SankeyChartProps = Writeable<
1011
const SankeyChart = defineComponent<SankeyChartProps>({
1112
name: 'SankeyChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={Sankey} {...ctx.attrs} {...props} />
14+
return () => <BaseChart chart={Sankey} {...mergeAttrs(props, ctx.attrs)} />
1415
},
1516
})
1617

0 commit comments

Comments
 (0)