remove cdn chart.js to import it

This commit is contained in:
Alexis Gousseau 2023-06-26 12:01:00 +02:00
parent 98cf4030e3
commit fa265018f8
8 changed files with 22 additions and 4 deletions

13
package-lock.json generated
View file

@ -18,6 +18,7 @@
"@vue/eslint-config-typescript": "^11.0.3",
"axios": "^0.21",
"bootstrap": "^5.3.0",
"chart.js": "^3.6.0",
"clean-webpack-plugin": "^4.0.0",
"eslint": "^8.42.0",
"eslint-plugin-vue": "^9.14.1",
@ -4054,6 +4055,12 @@
"node": "*"
}
},
"node_modules/chart.js": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.6.0.tgz",
"integrity": "sha512-iOzzDKePL+bj+ccIsVAgWQehCXv8xOKGbaU2fO/myivH736zcx535PGJzQGanvcSGVOqX6yuLZsN3ygcQ35UgQ==",
"dev": true
},
"node_modules/chokidar": {
"version": "3.5.3",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
@ -15320,6 +15327,12 @@
"integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==",
"dev": true
},
"chart.js": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.6.0.tgz",
"integrity": "sha512-iOzzDKePL+bj+ccIsVAgWQehCXv8xOKGbaU2fO/myivH736zcx535PGJzQGanvcSGVOqX6yuLZsN3ygcQ35UgQ==",
"dev": true
},
"chokidar": {
"version": "3.5.3",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",

View file

@ -27,6 +27,7 @@
"@vue/eslint-config-typescript": "^11.0.3",
"axios": "^0.21",
"bootstrap": "^5.3.0",
"chart.js": "^3.6.0",
"clean-webpack-plugin": "^4.0.0",
"eslint": "^8.42.0",
"eslint-plugin-vue": "^9.14.1",

View file

@ -8,4 +8,5 @@ import "./pages/customer.delete";
import "./pages/data.delete";
import "./pages/service.index";
import "./pages/search-bar-brand";
import "./pages/stats";
import "./pages/statsExport";

View file

@ -1,5 +1,6 @@
export {};
import { AxiosStatic } from "axios";
import { Chart } from "chart.js";
// * Enum
interface EnumInterface {
@ -79,6 +80,7 @@ declare global {
axios: AxiosStatic;
Swal: Function;
vueDebug: boolean | undefined;
ChartJS: typeof Chart;
__SYSTEM: {
_asset: string;
_locale: string;

View file

@ -0,0 +1,2 @@
import Chart from "chart.js/auto";
window.ChartJS = Chart;

View file

@ -40,6 +40,5 @@
@endif
@push('scripts')
<script src="https://cdn.jsdelivr.net/npm/chart.js@3.6.0/dist/chart.min.js" integrity="sha256-7lWo7cjrrponRJcS6bc8isfsPDwSKoaYfGIHgSheQkk=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/print-js@1.6.0/dist/print.js" integrity="sha256-M4dKA3UMrgzXdcBkWr0AwyeZJguOihkcsGrAf7Glwwc=" crossorigin="anonymous"></script>
@endpush

View file

@ -213,11 +213,11 @@
}
},
};
const chart = new Chart(
const chart = new ChartJS(
document.getElementById('chart'),
config
);
}
@endif
});
</script>
</script>

View file

@ -169,7 +169,7 @@ document.addEventListener("DOMContentLoaded", function(event) {
}
},
};
const chart = new Chart(
const chart = new ChartJS(
document.getElementById('chart'),
config
);