Skip to content

Commit 96f9f8f

Browse files
committed
release: @coreui/vue-chartjs v2.0.0
1 parent 147e24b commit 96f9f8f

File tree

4 files changed

+21
-65
lines changed

4 files changed

+21
-65
lines changed

packages/coreui-vue-chartjs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@coreui/vue-chartjs",
3-
"version": "2.0.0-rc.2",
3+
"version": "2.0.0",
44
"description": "Vue component wrapper for Chart.js",
55
"keywords": [
66
"coreui",

packages/coreui-vue-chartjs/rollup.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const plugins = [
99
external(),
1010
resolve({
1111
dedupe: ['vue'],
12-
extensions: ['.ts', '.json', '.vue'],
12+
extensions: ['.js', '.ts', '.json', '.vue'],
1313
}),
1414
typescript({
1515
exclude: ['**/__tests__/**'],

packages/coreui-vue-chartjs/src/CChart.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,4 +256,4 @@ const CChart = defineComponent({
256256
},
257257
})
258258

259-
export { CChart }
259+
export default CChart

packages/coreui-vue-chartjs/src/index.ts

Lines changed: 18 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,67 @@
1-
import { App, defineComponent, h, PropType } from 'vue'
2-
import { ChartData, ChartOptions, Plugin } from 'chart.js/auto'
3-
import { CChart } from './CChart'
4-
5-
const CChartProps = {
6-
customTooltips: {
7-
type: Boolean,
8-
default: true,
9-
required: false,
10-
},
11-
data: {
12-
type: [Object, Function] as PropType<ChartData | ((canvas: HTMLCanvasElement) => ChartData)>,
13-
required: true,
14-
},
15-
height: {
16-
type: Number,
17-
default: 150,
18-
required: false,
19-
},
20-
id: {
21-
type: String,
22-
default: undefined,
23-
required: false,
24-
},
25-
options: {
26-
type: Object as PropType<ChartOptions>,
27-
default: undefined,
28-
required: false,
29-
},
30-
plugins: {
31-
type: Array as PropType<Plugin[]>,
32-
default: undefined,
33-
required: false,
34-
},
35-
redraw: Boolean,
36-
width: {
37-
type: Number,
38-
default: 300,
39-
required: false,
40-
},
41-
wrapper: {
42-
type: Boolean,
43-
default: true,
44-
required: false,
45-
},
46-
}
1+
import { App, defineComponent, h } from 'vue'
2+
import CChart from './CChart'
473

484
const CChartBar = defineComponent({
5+
extends: CChart,
496
name: 'CChartBar',
50-
props: CChartProps,
517
setup(props) {
52-
return () => h(CChart, { type: 'bar', ...props })
8+
return () => h(CChart, { ...props, type: 'bar' })
539
},
5410
})
5511

5612
const CChartBubble = defineComponent({
13+
extends: CChart,
5714
name: 'CChartBubble',
58-
props: CChartProps,
5915
setup(props) {
60-
return () => h(CChart, { type: 'bubble', ...props })
16+
return () => h(CChart, { ...props, type: 'bubble' })
6117
},
6218
})
6319

6420
const CChartDoughnut = defineComponent({
21+
extends: CChart,
6522
name: 'CChartDoughnut',
66-
props: CChartProps,
6723
setup(props) {
68-
return () => h(CChart, { type: 'doughnut', ...props })
24+
return () => h(CChart, { ...props, type: 'doughnut' })
6925
},
7026
})
7127

7228
const CChartLine = defineComponent({
29+
extends: CChart,
7330
name: 'CChartLine',
74-
props: CChartProps,
7531
setup(props) {
76-
return () => h(CChart, { type: 'line', ...props })
32+
return () => h(CChart, { ...props, type: 'line' })
7733
},
7834
})
7935

8036
const CChartPie = defineComponent({
37+
extends: CChart,
8138
name: 'CChartPie',
82-
props: CChartProps,
8339
setup(props) {
84-
return () => h(CChart, { type: 'pie', ...props })
40+
return () => h(CChart, { ...props, type: 'pie' })
8541
},
8642
})
8743

8844
const CChartPolarArea = defineComponent({
45+
extends: CChart,
8946
name: 'CChartPolarArea',
90-
props: CChartProps,
9147
setup(props) {
92-
return () => h(CChart, { type: 'polarArea', ...props })
48+
return () => h(CChart, { ...props, type: 'polarArea' })
9349
},
9450
})
9551

9652
const CChartRadar = defineComponent({
53+
extends: CChart,
9754
name: 'CChartRadar',
98-
props: CChartProps,
9955
setup(props) {
100-
return () => h(CChart, { type: 'radar', ...props })
56+
return () => h(CChart, { ...props, type: 'radar' })
10157
},
10258
})
10359

10460
const CChartScatter = defineComponent({
61+
extends: CChart,
10562
name: 'CChartScatter',
106-
props: CChartProps,
10763
setup(props) {
108-
return () => h(CChart, { type: 'scatter', ...props })
64+
return () => h(CChart, { ...props, type: 'scatter' })
10965
},
11066
})
11167

0 commit comments

Comments
 (0)