updated the package and tests
This commit is contained in:
parent
07c8c35456
commit
26ff4f44c3
2
dist/ReactChartJs.d.ts.map
vendored
2
dist/ReactChartJs.d.ts.map
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"ReactChartJs.d.ts","sourceRoot":"","sources":["../src/ReactChartJs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACrD,OAAc,EAAE,iBAAiB,EAAqB,MAAM,OAAO,CAAC;AAEpE,UAAU,iBAAiB;IACvB,WAAW,CAAC,EAAE,kBAAkB,CAAC;CACpC;AAMD,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,CAiCtD,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
||||
{"version":3,"file":"ReactChartJs.d.ts","sourceRoot":"","sources":["../src/ReactChartJs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACrD,OAAc,EAAE,iBAAiB,EAAqB,MAAM,OAAO,CAAC;AAEpE,UAAU,iBAAiB;IACvB,WAAW,CAAC,EAAE,kBAAkB,CAAC;CACpC;AAMD,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,CA4BtD,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
4
dist/ReactChartJs.js
vendored
4
dist/ReactChartJs.js
vendored
@ -32,10 +32,6 @@ var ReactChartJs = function (props) {
|
||||
chartInstance.destroy();
|
||||
}
|
||||
chartInstanceRef.current.chartInstance = new chart_js_1.Chart(canvasDom, chartConfig);
|
||||
// if (!chartInstance) {
|
||||
// } else {
|
||||
// chartInstanceRef.current!.chartInstance.update()
|
||||
// }
|
||||
}, [chartConfig]);
|
||||
return (react_1.default.createElement("div", null,
|
||||
react_1.default.createElement("canvas", { ref: function (instance) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cubetiq/react-chart-js",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.4",
|
||||
"description": "Chart.js for React and TypeScript",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
@ -31,8 +31,8 @@
|
||||
"build": "tsc",
|
||||
"test": "jest",
|
||||
"build:test": "yarn jest && yarn build",
|
||||
"publish": "yarn build:test && npm publish --registry https://npm.osa.cubetiqs.com",
|
||||
"run:example": "cd example && yarn start"
|
||||
"publish": "yarn build:test && npm publish --registry https://npm.osa.cubetiqs.com --access public",
|
||||
"run:example": "cd examples/line-chart-example && yarn start"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.11.4",
|
||||
@ -41,6 +41,7 @@
|
||||
"@types/chart.js": "^2.9.25",
|
||||
"@types/jest": "^26.0.10",
|
||||
"@types/node": "^14.6.1",
|
||||
"@types/react": "^16.9.52",
|
||||
"@typescript-eslint/eslint-plugin": "^3.10.1",
|
||||
"@typescript-eslint/parser": "^3.10.1",
|
||||
"babel-jest": "^26.3.0",
|
||||
@ -51,6 +52,7 @@
|
||||
"jest": "^26.4.2",
|
||||
"lint-staged": "^10.2.13",
|
||||
"prettier": "^2.1.1",
|
||||
"react": "^16.14.0",
|
||||
"ts-jest": "^26.3.0",
|
||||
"tsc": "^1.20150623.0",
|
||||
"typescript": "^4.0.2"
|
||||
|
@ -9,7 +9,7 @@ interface RefForChartInstance {
|
||||
chartInstance?: Chart;
|
||||
}
|
||||
|
||||
const ReactChartJs: FunctionComponent<ReactChartJSProps> = (props) => {
|
||||
const ReactChartJs: FunctionComponent<ReactChartJSProps> = (props: any) => {
|
||||
const { chartConfig } = props;
|
||||
|
||||
const canvasDomRef = useRef<HTMLCanvasElement>();
|
||||
@ -29,7 +29,7 @@ const ReactChartJs: FunctionComponent<ReactChartJSProps> = (props) => {
|
||||
return (
|
||||
<div>
|
||||
<canvas
|
||||
ref={(instance) => {
|
||||
ref={(instance: any) => {
|
||||
canvasDomRef.current = instance!;
|
||||
}}
|
||||
width="400"
|
||||
|
3
test/App.test.ts
Normal file
3
test/App.test.ts
Normal file
@ -0,0 +1,3 @@
|
||||
test('adds 1 + 2 to equal 3', () => {
|
||||
expect(1 + 2).toBe(3);
|
||||
});
|
Loading…
Reference in New Issue
Block a user