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 1
1
import { Controller } from '@hotwired/stimulus' ;
2
- import { Chart } from 'chart.js' ;
2
+ import Chart from 'chart.js/auto ' ;
3
3
4
- class controller extends Controller {
4
+ class default_1 extends Controller {
5
5
connect ( ) {
6
6
if ( ! ( this . element instanceof HTMLCanvasElement ) ) {
7
7
throw new Error ( 'Invalid element' ) ;
8
8
}
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 ;
14
10
if ( Array . isArray ( payload . options ) && 0 === payload . options . length ) {
15
11
payload . options = { } ;
16
12
}
@@ -28,5 +24,8 @@ class controller extends Controller {
28
24
this . element . dispatchEvent ( userEvent ) ;
29
25
}
30
26
}
27
+ default_1 . values = {
28
+ view : Object ,
29
+ } ;
31
30
32
- export { controller as default } ;
31
+ export { default_1 as default } ;
Original file line number Diff line number Diff line change 15
15
},
16
16
"peerDependencies" : {
17
17
"@hotwired/stimulus" : " ^3.0.0" ,
18
- "chart.js" : " ^2.9.4 "
18
+ "chart.js" : " ^3.4.1 "
19
19
},
20
20
"devDependencies" : {
21
21
"@hotwired/stimulus" : " ^3.0.0" ,
22
22
"@types/chart.js" : " ^2.9.34" ,
23
- "chart.js" : " ^2.9.4 " ,
23
+ "chart.js" : " ^3.4.1 " ,
24
24
"jest-canvas-mock" : " ^2.3.0"
25
25
}
26
26
}
Original file line number Diff line number Diff line change 10
10
'use strict' ;
11
11
12
12
import { Controller } from '@hotwired/stimulus' ;
13
- import { Chart } from 'chart.js' ;
13
+ import Chart from 'chart.js/auto ' ;
14
14
15
15
export default class extends Controller {
16
16
static values = {
You can’t perform that action at this time.
0 commit comments