Skip to content

Commit 063d91b

Browse files
committed
fix: fix ts type error
1 parent 949f682 commit 063d91b

File tree

38 files changed

+84
-92
lines changed

38 files changed

+84
-92
lines changed

scripts/sync.js

+5-13
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ const eslint = new ESLint({
1616
fix: true,
1717
})
1818

19-
const g2PlotDir = path.resolve(
20-
process.cwd(),
21-
'node_modules/@antv/g2plot/src/plots'
22-
)
19+
const g2PlotDir = path.resolve(process.cwd(), 'node_modules/@antv/g2plot/src/plots')
2320
const plotDir = path.resolve(process.cwd(), 'src/plots')
2421
const testDir = path.resolve(process.cwd(), '__tests__/plots')
2522
const exportPath = path.resolve(process.cwd(), 'src/index.ts')
@@ -33,9 +30,7 @@ const newCharts = []
3330

3431
plotNames.forEach((chartName) => {
3532
try {
36-
if (
37-
!fs.existsSync(path.resolve(plotDir, `${kebabCase(chartName)}/index.tsx`))
38-
) {
33+
if (!fs.existsSync(path.resolve(plotDir, `${kebabCase(chartName)}/index.tsx`))) {
3934
newCharts.push(chartName)
4035
}
4136
} catch (error) {}
@@ -72,14 +67,14 @@ export type ${chart}ChartProps = Writeable<Omit<BaseChartProps<${chart}Options>,
7267
7368
const ${chart}Chart = defineComponent<${chart}ChartProps>({
7469
name: '${chart}Chart',
75-
setup(props, ctx) {
70+
setup: (props, ctx) => {
7671
return () => <BaseChart chart={${chart}} {...mergeAttrs(props, ctx.attrs)} />
7772
},
7873
})
7974
8075
/* istanbul ignore next */
8176
${chart}Chart.install = (app: App) => {
82-
app.component(${chart}Chart.name, ${chart}Chart)
77+
app.component('${chart}Chart', ${chart}Chart)
8378
}
8479
8580
export default ${chart}Chart
@@ -118,10 +113,7 @@ const addExport = async () => {
118113
exportFileContent += content
119114
})
120115

121-
const fixedContent = await lintAndFixFileContent(
122-
exportFileContent,
123-
exportPath
124-
)
116+
const fixedContent = await lintAndFixFileContent(exportFileContent, exportPath)
125117

126118
writeFile(exportPath, fixedContent, {
127119
encoding: 'utf8',

src/index.ts

+17-17
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import { PieChartProps as _PieChartProps } from './plots/pie'
1313
import { RadarChartProps as _RadarChartProps } from './plots/radar'
1414
import { RoseChartProps as _RoseChartProps } from './plots/rose'
1515
import { ScatterChartProps as _ScatterChartProps } from './plots/scatter'
16-
import { WordCloudChartProps as _WordCloudChartProps } from './plots/word-cloud'
1716
import { WaterfallChartProps as _WaterfallChartProps } from './plots/waterfall'
17+
import { WordCloudChartProps as _WordCloudChartProps } from './plots/word-cloud'
1818

1919
// mini plots
2020
import { ProgressChartProps as _ProgressChartProps } from './plots/progress'
@@ -95,9 +95,9 @@ export type RoseChartProps = _RoseChartProps
9595
export { default as ScatterChart } from './plots/scatter'
9696
export type ScatterChartProps = _ScatterChartProps
9797

98+
export { default as WaterfallChart } from './plots/waterfall'
9899
export { default as WordCloudChart } from './plots/word-cloud'
99100
export type WordCloudChartProps = _WordCloudChartProps
100-
export { default as WaterfallChart } from './plots/waterfall'
101101
export type WaterfallChartProps = _WaterfallChartProps
102102

103103
// mini plots
@@ -113,35 +113,35 @@ export type TinyAreaChartProps = _TinyAreaChartProps
113113
export { default as TinyColumnChart } from './plots/tiny-column'
114114
export type TinyColumnChartProps = _TinyColumnChartProps
115115

116+
export { default as BidirectionalBarChart } from './plots/bidirectional-bar'
117+
export { default as BoxChart } from './plots/box'
118+
export { default as ChordChart } from './plots/chord'
119+
export { default as CirclePackingChart } from './plots/circle-packing'
120+
export { default as DualAxesChart } from './plots/dual-axes'
121+
export { default as FacetChart } from './plots/facet'
122+
export { default as MixChart } from './plots/mix'
123+
export { default as MultiViewChart } from './plots/multi-view'
124+
export { default as RadialBarChart } from './plots/radial-bar'
125+
export { default as SankeyChart } from './plots/sankey'
126+
export { default as StockChart } from './plots/stock'
127+
export { default as SunburstChart } from './plots/sunburst'
116128
export { default as TinyLineChart } from './plots/tiny-line'
129+
export { default as TreemapChart } from './plots/treemap'
130+
export { default as VennChart } from './plots/venn'
131+
export { default as ViolinChart } from './plots/violin'
117132
export type TinyLineChartProps = _TinyLineChartProps
118-
export { default as DualAxesChart } from './plots/dual-axes'
119133
export type DualAxesChartProps = _DualAxesChartProps
120-
export { default as BoxChart } from './plots/box'
121134
export type BoxChartProps = _BoxChartProps
122-
export { default as StockChart } from './plots/stock'
123135
export type StockChartProps = _StockChartProps
124-
export { default as SunburstChart } from './plots/sunburst'
125136
export type SunburstChartProps = _SunburstChartProps
126-
export { default as RadialBarChart } from './plots/radial-bar'
127137
export type RadialBarChartProps = _RadialBarChartProps
128-
export { default as BidirectionalBarChart } from './plots/bidirectional-bar'
129138
export type BidirectionalBarChartProps = _BidirectionalBarChartProps
130-
export { default as TreemapChart } from './plots/treemap'
131139
export type TreemapChartProps = _TreemapChartProps
132-
export { default as SankeyChart } from './plots/sankey'
133140
export type SankeyChartProps = _SankeyChartProps
134-
export { default as ChordChart } from './plots/chord'
135141
export type ChordChartProps = _ChordChartProps
136-
export { default as MultiViewChart } from './plots/multi-view'
137142
export type MultiViewChartProps = _MultiViewChartProps
138-
export { default as MixChart } from './plots/mix'
139143
export type MixChartProps = _MixChartProps
140-
export { default as ViolinChart } from './plots/violin'
141144
export type ViolinChartProps = _ViolinChartProps
142-
export { default as FacetChart } from './plots/facet'
143145
export type FacetChartProps = _FacetChartProps
144-
export { default as CirclePackingChart } from './plots/circle-packing'
145146
export type CirclePackingChartProps = _CirclePackingChartProps
146-
export { default as VennChart } from './plots/venn'
147147
export type VennChartProps = _VennChartProps

src/plots/area/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const AreaChart = defineComponent<AreaChartProps>({
1515

1616
/* istanbul ignore next */
1717
AreaChart.install = (app: App) => {
18-
app.component(AreaChart.name, AreaChart)
18+
app.component('AreaChart', AreaChart)
1919
}
2020

2121
export default AreaChart

src/plots/bar/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const BarChart = defineComponent<BarChartProps>({
1515

1616
/* istanbul ignore next */
1717
BarChart.install = (app: App) => {
18-
app.component(BarChart.name, BarChart)
18+
app.component('BarChart', BarChart)
1919
}
2020

2121
export default BarChart

src/plots/bidirectional-bar/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const BidirectionalBarChart = defineComponent<BidirectionalBarChartProps>({
1717

1818
/* istanbul ignore next */
1919
BidirectionalBarChart.install = (app: App) => {
20-
app.component(BidirectionalBarChart.name, BidirectionalBarChart)
20+
app.component('BidirectionalBarChart', BidirectionalBarChart)
2121
}
2222

2323
export default BidirectionalBarChart

src/plots/box/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const BoxChart = defineComponent<BoxChartProps>({
1515

1616
/* istanbul ignore next */
1717
BoxChart.install = (app: App) => {
18-
app.component(BoxChart.name, BoxChart)
18+
app.component('BoxChart', BoxChart)
1919
}
2020

2121
export default BoxChart

src/plots/bullet/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const BulletChart = defineComponent<BulletChartProps>({
1515

1616
/* istanbul ignore next */
1717
BulletChart.install = (app: App) => {
18-
app.component(BulletChart.name, BulletChart)
18+
app.component('BulletChart', BulletChart)
1919
}
2020

2121
export default BulletChart

src/plots/chord/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const ChordChart = defineComponent<ChordChartProps>({
1515

1616
/* istanbul ignore next */
1717
ChordChart.install = (app: App) => {
18-
app.component(ChordChart.name, ChordChart)
18+
app.component('ChordChart', ChordChart)
1919
}
2020

2121
export default ChordChart

src/plots/circle-packing/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ export type CirclePackingChartProps = Writeable<
1010

1111
const CirclePackingChart = defineComponent<CirclePackingChartProps>({
1212
name: 'CirclePackingChart',
13-
setup(props, ctx) {
13+
setup: (props, ctx) => {
1414
return () => <BaseChart chart={CirclePacking} {...mergeAttrs(props, ctx.attrs)} />
1515
},
1616
})
1717

1818
/* istanbul ignore next */
1919
CirclePackingChart.install = (app: App) => {
20-
app.component(CirclePackingChart.name, CirclePackingChart)
20+
app.component('CirclePackingChart', CirclePackingChart)
2121
}
2222

2323
export default CirclePackingChart

src/plots/column/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineComponent, App } from 'vue-demi'
1+
import { App, defineComponent } from 'vue-demi'
22
import { Column, ColumnOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
@@ -15,7 +15,7 @@ const ColumnChart = defineComponent<ColumnChartProps>({
1515

1616
/* istanbul ignore next */
1717
ColumnChart.install = (app: App) => {
18-
app.component(ColumnChart.name, ColumnChart)
18+
app.component('ColumnChart', ColumnChart)
1919
}
2020

2121
export default ColumnChart

src/plots/dual-axes/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const DualAxesChart = defineComponent<DualAxesChartProps>({
1515

1616
/* istanbul ignore next */
1717
DualAxesChart.install = (app: App) => {
18-
app.component(DualAxesChart.name, DualAxesChart)
18+
app.component('DualAxesChart', DualAxesChart)
1919
}
2020

2121
export default DualAxesChart

src/plots/facet/index.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Facet, FacetOptions } from '@antv/g2plot'
21
import { App, defineComponent } from 'vue-demi'
2+
import { Facet, FacetOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
55
import { mergeAttrs } from '../../utils'
@@ -8,14 +8,14 @@ export type FacetChartProps = Writeable<Omit<BaseChartProps<FacetOptions>, 'char
88

99
const FacetChart = defineComponent<FacetChartProps>({
1010
name: 'FacetChart',
11-
setup(props, ctx) {
11+
setup: (props, ctx) => {
1212
return () => <BaseChart chart={Facet} {...mergeAttrs(props, ctx.attrs)} />
1313
},
1414
})
1515

1616
/* istanbul ignore next */
1717
FacetChart.install = (app: App) => {
18-
app.component(FacetChart.name, FacetChart)
18+
app.component('FacetChart', FacetChart)
1919
}
2020

2121
export default FacetChart

src/plots/funnel/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineComponent, App } from 'vue-demi'
1+
import { App, defineComponent } from 'vue-demi'
22
import { Funnel, FunnelOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
@@ -15,7 +15,7 @@ const FunnelChart = defineComponent<FunnelChartProps>({
1515

1616
/* istanbul ignore next */
1717
FunnelChart.install = (app: App) => {
18-
app.component(FunnelChart.name, FunnelChart)
18+
app.component('FunnelChart', FunnelChart)
1919
}
2020

2121
export default FunnelChart

src/plots/gauge/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineComponent, App } from 'vue-demi'
1+
import { App, defineComponent } from 'vue-demi'
22
import { Gauge, GaugeOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
@@ -15,7 +15,7 @@ const GaugeChart = defineComponent<GaugeChartProps>({
1515

1616
/* istanbul ignore next */
1717
GaugeChart.install = (app: App) => {
18-
app.component(GaugeChart.name, GaugeChart)
18+
app.component('GaugeChart', GaugeChart)
1919
}
2020

2121
export default GaugeChart

src/plots/heatmap/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineComponent, App } from 'vue-demi'
1+
import { App, defineComponent } from 'vue-demi'
22
import { Heatmap, HeatmapOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
@@ -15,7 +15,7 @@ const HeatmapChart = defineComponent<HeatmapChartProps>({
1515

1616
/* istanbul ignore next */
1717
HeatmapChart.install = (app: App) => {
18-
app.component(HeatmapChart.name, HeatmapChart)
18+
app.component('HeatmapChart', HeatmapChart)
1919
}
2020

2121
export default HeatmapChart

src/plots/histogram/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineComponent, App } from 'vue-demi'
1+
import { App, defineComponent } from 'vue-demi'
22
import { Histogram, HistogramOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
@@ -15,7 +15,7 @@ const HistogramChart = defineComponent<HistogramChartProps>({
1515

1616
/* istanbul ignore next */
1717
HistogramChart.install = (app: App) => {
18-
app.component(HistogramChart.name, HistogramChart)
18+
app.component('HistogramChart', HistogramChart)
1919
}
2020

2121
export default HistogramChart

src/plots/line/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineComponent, App } from 'vue-demi'
1+
import { App, defineComponent } from 'vue-demi'
22
import { Line, LineOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
@@ -15,7 +15,7 @@ const LineChart = defineComponent<LineChartProps>({
1515

1616
/* istanbul ignore next */
1717
LineChart.install = (app: App) => {
18-
app.component(LineChart.name, LineChart)
18+
app.component('LineChart', LineChart)
1919
}
2020

2121
export default LineChart

src/plots/liquid/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineComponent, App } from 'vue-demi'
1+
import { App, defineComponent } from 'vue-demi'
22
import { Liquid, LiquidOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
@@ -15,7 +15,7 @@ const LiquidChart = defineComponent<LiquidChartProps>({
1515

1616
/* istanbul ignore next */
1717
LiquidChart.install = (app: App) => {
18-
app.component(LiquidChart.name, LiquidChart)
18+
app.component('LiquidChart', LiquidChart)
1919
}
2020

2121
export default LiquidChart

src/plots/mix/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ export type MixChartProps = Writeable<Omit<BaseChartProps<MixOptions>, 'chart' |
88

99
const MixChart = defineComponent<MixChartProps>({
1010
name: 'MixChart',
11-
setup(props, ctx) {
11+
setup: (props, ctx) => {
1212
return () => <BaseChart chart={Mix} {...mergeAttrs(props, ctx.attrs)} />
1313
},
1414
})
1515

1616
/* istanbul ignore next */
1717
MixChart.install = (app: App) => {
18-
app.component(MixChart.name, MixChart)
18+
app.component('MixChart', MixChart)
1919
}
2020

2121
export default MixChart

src/plots/multi-view/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { App, defineComponent } from 'vue-demi'
21
import { Mix, MixOptions } from '@antv/g2plot'
2+
import { App, defineComponent } from 'vue-demi'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
55
import { mergeAttrs } from '../../utils'
@@ -18,7 +18,7 @@ const MultiViewChart = defineComponent<MultiViewChartProps>({
1818

1919
/* istanbul ignore next */
2020
MultiViewChart.install = (app: App) => {
21-
app.component(MultiViewChart.name, MultiViewChart)
21+
app.component('MultiViewChart', MultiViewChart)
2222
}
2323

2424
export default MultiViewChart

src/plots/pie/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineComponent, App } from 'vue-demi'
1+
import { App, defineComponent } from 'vue-demi'
22
import { Pie, PieOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
@@ -15,7 +15,7 @@ const PieChart = defineComponent<PieChartProps>({
1515

1616
/* istanbul ignore next */
1717
PieChart.install = (app: App) => {
18-
app.component(PieChart.name, PieChart)
18+
app.component('PieChart', PieChart)
1919
}
2020

2121
export default PieChart

src/plots/progress/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineComponent, App } from 'vue-demi'
1+
import { App, defineComponent } from 'vue-demi'
22
import { Progress, ProgressOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
@@ -15,7 +15,7 @@ const ProgressChart = defineComponent<ProgressChartProps>({
1515

1616
/* istanbul ignore next */
1717
ProgressChart.install = (app: App) => {
18-
app.component(ProgressChart.name, ProgressChart)
18+
app.component('ProgressChart', ProgressChart)
1919
}
2020

2121
export default ProgressChart

0 commit comments

Comments
 (0)