keystone_ui 0.29.2 → 0.29.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6957989b7a51f3fdd94ce32536025f31b9f3d1cc35fae4b92c1957da717ffd80
|
|
4
|
+
data.tar.gz: 9c3a4af4f7a27c7082ca8bf64578de1d96a415cf06019143bf1b9dbbc1f9b0ac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 60cb001c00c818f4990338a8ad9575ba48d97fd1874dbc86ac03370959b49223cf82c4bf3b92d4b65ddbd0d92e7a5fceba909cbd558222dc584e96473402e910
|
|
7
|
+
data.tar.gz: 9148787bdf6de7526e77cd73012d156468183d0f5b3a21e5a873d71c6d677b35fbc2ad8c8adc7735b9ed9f0523912f3b80907bd8cc96eb1fa5ba52fea581d6a7
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import { Controller } from "@hotwired/stimulus"
|
|
2
|
-
import { Chart, registerables } from "chart.js"
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
const loadChart = async () => {
|
|
4
|
+
const { Chart, registerables } = await import("chart.js")
|
|
5
|
+
Chart.register(...registerables)
|
|
6
|
+
return Chart
|
|
7
|
+
}
|
|
5
8
|
|
|
6
9
|
export default class extends Controller {
|
|
7
10
|
static targets = ["canvas"]
|
|
8
11
|
static values = { data: Object }
|
|
9
12
|
|
|
10
|
-
connect() {
|
|
13
|
+
async connect() {
|
|
14
|
+
const Chart = await loadChart()
|
|
15
|
+
if (!this.element.isConnected) return
|
|
16
|
+
|
|
11
17
|
this.chart = new Chart(this.canvasTarget, {
|
|
12
18
|
type: "line",
|
|
13
19
|
data: this.resolveColors(this.dataValue),
|
data/config/importmap.rb
CHANGED
|
@@ -20,4 +20,4 @@ pin "keystone_ui/page_theme", to: "keystone_ui/page_theme.js"
|
|
|
20
20
|
|
|
21
21
|
# Chart.js for the line-chart controller, so host apps don't pin it themselves.
|
|
22
22
|
# Vendored as a single self-contained bundle (deps inlined, no external imports).
|
|
23
|
-
pin "chart.js", to: "keystone_ui/chartjs.js"
|
|
23
|
+
pin "chart.js", to: "keystone_ui/chartjs.js", preload: false
|
data/lib/keystone_ui/version.rb
CHANGED