File tree Expand file tree Collapse file tree 3 files changed +10
-11
lines changed
src/Chartjs/Resources/assets Expand file tree Collapse file tree 3 files changed +10
-11
lines changed Original file line number Diff line number Diff line change 11import { Controller } from '@hotwired/stimulus' ;
2- import { Chart } from 'chart.js' ;
2+ import Chart from 'chart.js/auto ' ;
33
4- class controller extends Controller {
4+ class default_1 extends Controller {
55 connect ( ) {
66 if ( ! ( this . element instanceof HTMLCanvasElement ) ) {
77 throw new Error ( 'Invalid element' ) ;
88 }
9- const viewData = this . element . getAttribute ( 'data-view' ) ;
10- if ( ! viewData ) {
11- throw new Error ( 'Missing data-view attribute.' ) ;
12- }
13- const payload = JSON . parse ( viewData ) ;
9+ const payload = this . viewValue ;
1410 if ( Array . isArray ( payload . options ) && 0 === payload . options . length ) {
1511 payload . options = { } ;
1612 }
@@ -28,5 +24,8 @@ class controller extends Controller {
2824 this . element . dispatchEvent ( userEvent ) ;
2925 }
3026}
27+ default_1 . values = {
28+ view : Object ,
29+ } ;
3130
32- export { controller as default } ;
31+ export { default_1 as default } ;
Original file line number Diff line number Diff line change 1515 },
1616 "peerDependencies" : {
1717 "@hotwired/stimulus" : " ^3.0.0" ,
18- "chart.js" : " ^2.9.4 "
18+ "chart.js" : " ^3.4.1 "
1919 },
2020 "devDependencies" : {
2121 "@hotwired/stimulus" : " ^3.0.0" ,
2222 "@types/chart.js" : " ^2.9.34" ,
23- "chart.js" : " ^2.9.4 " ,
23+ "chart.js" : " ^3.4.1 " ,
2424 "jest-canvas-mock" : " ^2.3.0"
2525 }
2626}
Original file line number Diff line number Diff line change 1010'use strict' ;
1111
1212import { Controller } from '@hotwired/stimulus' ;
13- import { Chart } from 'chart.js' ;
13+ import Chart from 'chart.js/auto ' ;
1414
1515export default class extends Controller {
1616 static values = {
You can’t perform that action at this time.
0 commit comments