@wikicasa-dev/components 2.4.1-alpha.9 → 2.4.2-alpha.0
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.
- package/dist/ChartJs/Chart.js +4 -0
- package/dist/ChartJs/DoughnutChart/core.js +6 -0
- package/dist/ChartJs/LineChart/cartesian.js +6 -0
- package/dist/ChartJs/LineChart/core.js +6 -0
- package/dist/ChartJs/Plugins/Legend.js +2 -0
- package/dist/ChartJs/Plugins/TimeScale.js +3 -0
- package/dist/ChartJs/Plugins/Title.js +2 -0
- package/dist/ChartJs/Plugins/Tooltip.js +2 -0
- package/dist/Swiper/Autoplay/factory.js +9 -0
- package/dist/Swiper/Autoplay/index.js +5 -0
- package/dist/Swiper/Controller/factory.js +9 -0
- package/dist/Swiper/{controller.js → Controller/index.js} +2 -2
- package/dist/Swiper/FreeMode/factory.js +9 -0
- package/dist/Swiper/FreeMode/index.js +5 -0
- package/dist/Swiper/Keyboard/factory.js +9 -0
- package/dist/Swiper/Keyboard/index.js +5 -0
- package/dist/Swiper/Navigation/factory.js +17 -0
- package/dist/Swiper/Navigation/index.js +5 -0
- package/dist/Swiper/Pagination/factory.js +17 -0
- package/dist/Swiper/Pagination/index.js +5 -0
- package/dist/Swiper/Thumbs/factory.js +9 -0
- package/dist/Swiper/Thumbs/index.js +5 -0
- package/dist/Swiper/Zoom/factory.js +9 -0
- package/dist/Swiper/Zoom/index.js +5 -0
- package/dist/Swiper/factory.js +13 -0
- package/dist/Swiper/index.js +5 -0
- package/dist/Swiper/types.js +1 -0
- package/dist/UIKit/BaseModal.d.ts +0 -1
- package/dist/VueChartJs/Doughnut/factory.js +12 -0
- package/dist/VueChartJs/Doughnut/index.js +4 -0
- package/dist/VueChartJs/Line/factory.js +14 -0
- package/dist/VueChartJs/Line/index.js +4 -0
- package/dist/assets/SwiperCarousel.css +1 -1
- package/dist/assets/SwiperCarousel2.css +1 -1
- package/dist/assets/tailwind.css +1 -1
- package/dist/components/IntersectionObserver/IntersectionObserver.d.ts +1 -1
- package/dist/components/carousel/SwiperCarousel.d.ts +9 -2327
- package/dist/components/carousel/SwiperCarousel.js +1 -1
- package/dist/packages/components/lib/UIKit/BaseModal.vue.js +51 -53
- package/dist/packages/components/lib/chart/DoughnutChart.vue.js +14 -15
- package/dist/packages/components/lib/chart/LineChart.vue.js +19 -31
- package/dist/packages/components/lib/components/carousel/SwiperCarousel.vue.js +128 -165
- package/package.json +1 -1
- package/dist/Swiper/autoplay.js +0 -5
- package/dist/Swiper/free-mode.js +0 -5
- package/dist/Swiper/keyboard.js +0 -5
- package/dist/Swiper/navigation.js +0 -5
- package/dist/Swiper/pagination.js +0 -5
- package/dist/Swiper/thumbs.js +0 -5
- package/dist/chart/composables/useChartjsModules.d.ts +0 -10
- package/dist/chart/composables/useChartjsModules.js +0 -37
- /package/dist/assets/{swiper-keyboard.css → swiper-autoplay.css} +0 -0
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { defineComponent as Q,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { defineComponent as Q, useTemplateRef as z, shallowRef as U, useId as X, computed as Y, onMounted as x, watch as _, nextTick as M, createElementBlock as n, openBlock as l, normalizeClass as d, createElementVNode as p, createCommentVNode as b, unref as ee, renderSlot as C, Fragment as k, renderList as L, mergeProps as V, withModifiers as O } from "vue";
|
|
2
|
+
import { createSwiper as R } from "../../../../../Swiper/factory.js";
|
|
3
|
+
import { AutoplayModule as te } from "../../../../../Swiper/Autoplay/factory.js";
|
|
4
|
+
import { ControllerModule as se } from "../../../../../Swiper/Controller/factory.js";
|
|
5
|
+
import { FreemodeModule as ie } from "../../../../../Swiper/FreeMode/factory.js";
|
|
6
|
+
import { KeyboardModule as re } from "../../../../../Swiper/Keyboard/factory.js";
|
|
7
|
+
import { NavigationModule as ae } from "../../../../../Swiper/Navigation/factory.js";
|
|
8
|
+
import { PaginationModule as oe } from "../../../../../Swiper/Pagination/factory.js";
|
|
9
|
+
import { ThumbsModule as ne } from "../../../../../Swiper/Thumbs/factory.js";
|
|
10
|
+
import { ZoomModule as le } from "../../../../../Swiper/Zoom/factory.js";
|
|
11
|
+
const de = ["data-cy"], ue = ["data-idx", "alt", "width", "height", "onLoad"], ce = ["alt"], ke = /* @__PURE__ */ Q({
|
|
8
12
|
inheritAttrs: !1,
|
|
9
13
|
__name: "SwiperCarousel",
|
|
10
14
|
props: {
|
|
@@ -18,229 +22,188 @@ const te = ["id"], se = ["id", "data-cy"], ie = ["data-idx", "alt", "width", "he
|
|
|
18
22
|
shiftFirstImage: { type: Boolean, default: !1 }
|
|
19
23
|
},
|
|
20
24
|
emits: ["moved", "click", "firstSlideLoaded", "init"],
|
|
21
|
-
setup(
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
initCarousel: !1
|
|
26
|
-
}), S = k(), j = k(!1), A = X(), p = f(() => s.id ?? A), N = f(() => a.swiper), g = f(() => s.swiperOptions?.slidesPerView || 1), W = f(() => !!s.swiperOptions?.keyboard), C = f(() => !!s.swiperOptions.navigation), I = f(() => !!s.swiperOptions.pagination), q = f(() => !!s.swiperOptions.autoplay), K = f(
|
|
27
|
-
() => s.swiperOptions?.effect || "slider"
|
|
28
|
-
), R = () => {
|
|
29
|
-
s.swiperOptions && ee(s.swiperOptions, a.swiperParams);
|
|
30
|
-
}, z = (e, i = -1, t = !1) => {
|
|
25
|
+
setup(t, { expose: T, emit: B }) {
|
|
26
|
+
const h = B;
|
|
27
|
+
let u = null;
|
|
28
|
+
const y = z("rootRef"), D = z("thumbsRef"), A = U(!1), F = X(), $ = Y(() => t.id ?? F), w = t.swiperOptions?.slidesPerView || 1, N = !!t.swiperOptions?.keyboard, S = !!t.swiperOptions.navigation, I = !!t.swiperOptions.pagination, j = !!t.swiperOptions.autoplay, q = t.swiperOptions?.effect || "slider", P = (e, s = -1, i = !1) => {
|
|
31
29
|
if (!e.images)
|
|
32
30
|
return { src: e.src || "" };
|
|
33
|
-
let r = "", o = "",
|
|
34
|
-
if (
|
|
35
|
-
for (const
|
|
36
|
-
const { mq:
|
|
37
|
-
|
|
31
|
+
let r = "", o = "", g = "";
|
|
32
|
+
if (t.artDirection) {
|
|
33
|
+
for (const a in t.artDirection) {
|
|
34
|
+
const { mq: c, width: f } = t.artDirection[a];
|
|
35
|
+
f && (g += g ? `,${c} ${parseInt(f)}px` : `${c} ${parseInt(f)}px`);
|
|
38
36
|
}
|
|
39
|
-
o = e.images.reduce((
|
|
40
|
-
const m = Object.values(
|
|
41
|
-
return !m || !m.width || (
|
|
37
|
+
o = e.images.reduce((a, c, f) => {
|
|
38
|
+
const m = Object.values(t.artDirection)[f];
|
|
39
|
+
return !m || !m.width || (a += a ? `, ${c.storagePath} ${m.width}` : `${c.storagePath} ${m.width}`), a;
|
|
42
40
|
}, ""), r = e.images[0].storagePath;
|
|
43
41
|
} else {
|
|
44
|
-
let
|
|
45
|
-
e.images.length > 3 ?
|
|
42
|
+
let a = e.images;
|
|
43
|
+
e.images.length > 3 ? a = e.images.slice(2, 5) : t.shiftFirstImage && (a[0] = a[1]), o = a.reduce((c, f, m) => (m === 0 && (r = `${f.storagePath}`), m > 0 && (c += ", "), `${c}${f.storagePath} ${m + 1}x`), "");
|
|
46
44
|
}
|
|
47
45
|
const H = r, J = o;
|
|
48
|
-
return typeof
|
|
46
|
+
return typeof w == "number" && s > w ? (r = "", o = "", { sizes: g, "data-src": H, "data-srcset": J }) : i ? {
|
|
49
47
|
src: r,
|
|
50
48
|
srcset: o,
|
|
51
|
-
sizes:
|
|
49
|
+
sizes: g,
|
|
52
50
|
loading: "lazy",
|
|
53
51
|
fetchpriority: "low"
|
|
54
52
|
} : {
|
|
55
53
|
src: r,
|
|
56
54
|
srcset: o,
|
|
57
|
-
sizes:
|
|
58
|
-
loading:
|
|
59
|
-
fetchpriority: !
|
|
55
|
+
sizes: g,
|
|
56
|
+
loading: t.lazyLoadImages || s >= w ? "lazy" : void 0,
|
|
57
|
+
fetchpriority: !t.lazyLoadImages && s === 0 ? "high" : "low"
|
|
60
58
|
};
|
|
61
|
-
},
|
|
62
|
-
if (typeof
|
|
63
|
-
const
|
|
64
|
-
if (
|
|
59
|
+
}, v = [], E = (e) => {
|
|
60
|
+
if (typeof w == "string") return;
|
|
61
|
+
const s = v[e];
|
|
62
|
+
if (s && !s.src && (s.src = s.dataset.src || "", s.srcset = s.dataset.srcset || ""), e < w || e + 1 >= (t.images ?? []).length)
|
|
65
63
|
return;
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
},
|
|
69
|
-
e
|
|
70
|
-
|
|
64
|
+
const i = v[e + 1];
|
|
65
|
+
i && !i.src && (i.src = i?.dataset.src || "", i.srcset = i?.dataset.srcset || "");
|
|
66
|
+
}, K = (e) => {
|
|
67
|
+
e || !v?.[e] || M(() => {
|
|
68
|
+
y.value?.setAttribute("data-first-slide-loaded", "true"), h("firstSlideLoaded");
|
|
71
69
|
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
</div>`,
|
|
87
|
-
...typeof a.swiperParams.pagination == "boolean" ? {} : a.swiperParams.pagination
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
if (C.value) {
|
|
91
|
-
const { Navigation: t } = await import("../../../../../Swiper/navigation.js");
|
|
92
|
-
a.swiperParams.modules?.push(t);
|
|
93
|
-
const r = {
|
|
94
|
-
...s.swiperOptions.navigation.nextEl ?? {
|
|
95
|
-
nextEl: ".swiper-button-next"
|
|
96
|
-
},
|
|
97
|
-
...s.swiperOptions.navigation.prevEl ?? {
|
|
98
|
-
prevEl: ".swiper-button-prev"
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
a.swiperParams.navigation = {
|
|
102
|
-
...typeof s.swiperOptions.navigation == "object" ? s.swiperOptions.navigation : {},
|
|
103
|
-
...r
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
if (q.value) {
|
|
107
|
-
const { Autoplay: t } = await import("../../../../../Swiper/autoplay.js");
|
|
108
|
-
a.swiperParams.modules?.push(t), a.swiperParams.autoplay = s.swiperOptions.autoplay;
|
|
109
|
-
}
|
|
110
|
-
const e = {
|
|
111
|
-
...a.swiperParams,
|
|
112
|
-
on: {
|
|
113
|
-
init: () => {
|
|
114
|
-
j.value = !0, y("init");
|
|
70
|
+
}, W = (e) => t.thumbSwiperOptions ? R(e, t.thumbSwiperOptions, [
|
|
71
|
+
ie(t.thumbSwiperOptions.freeMode)
|
|
72
|
+
]) : null, Z = async (e, s) => {
|
|
73
|
+
const i = s ? await W(s) : null;
|
|
74
|
+
u = await R(
|
|
75
|
+
e,
|
|
76
|
+
{
|
|
77
|
+
on: {
|
|
78
|
+
init: () => {
|
|
79
|
+
A.value = !0, h("init");
|
|
80
|
+
},
|
|
81
|
+
slideChange: (r) => {
|
|
82
|
+
E(r.activeIndex), h("moved", { activeIndex: r.activeIndex });
|
|
83
|
+
}
|
|
115
84
|
},
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
85
|
+
...i ? { thumbs: { swiper: i } } : {},
|
|
86
|
+
...t.swiperOptions
|
|
87
|
+
},
|
|
88
|
+
[
|
|
89
|
+
le(t.swiperOptions.zoom),
|
|
90
|
+
N ? re(t.swiperOptions.keyboard) : void 0,
|
|
91
|
+
I ? oe(t.swiperOptions.pagination) : void 0,
|
|
92
|
+
S ? ae(t.swiperOptions.navigation) : void 0,
|
|
93
|
+
j ? te(t.swiperOptions.autoplay) : void 0,
|
|
94
|
+
//Thumbs specific modules
|
|
95
|
+
i ? ne(t.swiperOptions.thumbs) : void 0,
|
|
96
|
+
i ? se(t.swiperOptions.controller) : void 0
|
|
97
|
+
].filter(Boolean)
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
x(() => {
|
|
101
|
+
y.value && setTimeout(() => Z(y.value, D.value));
|
|
102
|
+
});
|
|
103
|
+
const G = (e) => {
|
|
104
|
+
!u || u.params.slidesPerView === e || (u.params.slidesPerView = e, u.update());
|
|
105
|
+
};
|
|
106
|
+
return _(
|
|
107
|
+
() => t.images,
|
|
138
108
|
() => {
|
|
139
|
-
|
|
140
|
-
|
|
109
|
+
M(() => {
|
|
110
|
+
u?.update();
|
|
141
111
|
});
|
|
142
112
|
}
|
|
143
|
-
),
|
|
144
|
-
swiper:
|
|
145
|
-
moveTo(e,
|
|
146
|
-
|
|
113
|
+
), T({
|
|
114
|
+
swiper: u,
|
|
115
|
+
moveTo(e, s = 0, i = !0) {
|
|
116
|
+
u?.slideTo(e, s, i);
|
|
147
117
|
},
|
|
148
|
-
updateSlidesPerView:
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
}), (e, i) => (u(), l("div", {
|
|
152
|
-
id: `root-${p.value}`,
|
|
153
|
-
ref_key: "root",
|
|
154
|
-
ref: L,
|
|
118
|
+
updateSlidesPerView: G
|
|
119
|
+
}), (e, s) => (l(), n("div", {
|
|
155
120
|
class: d(["swiper-carousel-root", e.$attrs["root-classes"]])
|
|
156
121
|
}, [
|
|
157
|
-
|
|
158
|
-
|
|
122
|
+
p("div", {
|
|
123
|
+
ref: "rootRef",
|
|
159
124
|
"data-cy": e.$attrs["data-cy"],
|
|
160
|
-
class: d(["swiper", e.$attrs["swiper-classes"]])
|
|
125
|
+
class: d(["swiper uikit-carousel", e.$attrs["swiper-classes"]])
|
|
161
126
|
}, [
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
ref: S,
|
|
127
|
+
p("div", {
|
|
128
|
+
ref: "swiperWrapperRef",
|
|
165
129
|
class: d(["swiper-wrapper", [
|
|
166
130
|
e.$attrs["swiper-wrapper-classes"],
|
|
167
|
-
|
|
131
|
+
ee(q) === "none" && "no-transition"
|
|
168
132
|
]]),
|
|
169
|
-
onClick:
|
|
133
|
+
onClick: s[0] || (s[0] = (i) => h("click"))
|
|
170
134
|
}, [
|
|
171
|
-
|
|
172
|
-
(
|
|
173
|
-
key: `swiper_${
|
|
135
|
+
C(e.$slots, "default", {}, () => [
|
|
136
|
+
(l(!0), n(k, null, L(t.images, (i, r) => (l(), n("div", {
|
|
137
|
+
key: `swiper_${$.value}_${r}`,
|
|
174
138
|
class: d(["swiper-slide", e.$attrs["swiper-slide-classes"]])
|
|
175
139
|
}, [
|
|
176
|
-
|
|
140
|
+
p("div", {
|
|
177
141
|
class: d(["swiper-zoom-container", e.$attrs["swiper-zoom-container-classes"]])
|
|
178
142
|
}, [
|
|
179
|
-
|
|
143
|
+
t.backgroundImage ? b("", !0) : (l(), n("img", V({
|
|
180
144
|
key: 0,
|
|
181
145
|
ref_for: !0,
|
|
182
146
|
ref: (o) => {
|
|
183
|
-
|
|
147
|
+
v.push(o);
|
|
184
148
|
},
|
|
185
|
-
class: ["disable-select", [e.$attrs["slide-img-classes"] ||
|
|
186
|
-
"data-idx": `${
|
|
187
|
-
}, { ref_for: !0 },
|
|
188
|
-
alt:
|
|
149
|
+
class: ["disable-select", [e.$attrs["slide-img-classes"] || i.classes]],
|
|
150
|
+
"data-idx": `${$.value}-slide-img-${r}`
|
|
151
|
+
}, { ref_for: !0 }, P(i, r), {
|
|
152
|
+
alt: i.alt,
|
|
189
153
|
itemprop: "image",
|
|
190
|
-
width:
|
|
191
|
-
height:
|
|
192
|
-
onLoad: (o) =>
|
|
193
|
-
}), null, 16,
|
|
154
|
+
width: i.width,
|
|
155
|
+
height: i.height,
|
|
156
|
+
onLoad: (o) => K(r)
|
|
157
|
+
}), null, 16, ue))
|
|
194
158
|
], 2)
|
|
195
159
|
], 2))), 128)),
|
|
196
|
-
|
|
160
|
+
C(e.$slots, "last_slide", {}, void 0, !0)
|
|
197
161
|
], !0)
|
|
198
162
|
], 2),
|
|
199
|
-
I
|
|
163
|
+
I ? (l(), n("div", {
|
|
200
164
|
key: 0,
|
|
201
165
|
class: d([e.$attrs["swiper-pagination-classes"], "swiper-pagination [&.swiper-pagination-fraction]:uikit-flex [&.swiper-pagination-fraction]:uikit-justify-center"]),
|
|
202
|
-
onClick:
|
|
166
|
+
onClick: s[1] || (s[1] = O(() => {
|
|
203
167
|
}, ["stop"]))
|
|
204
|
-
}, null, 2)) :
|
|
205
|
-
|
|
206
|
-
|
|
168
|
+
}, null, 2)) : b("", !0),
|
|
169
|
+
S ? (l(), n(k, { key: 1 }, [
|
|
170
|
+
p("div", {
|
|
207
171
|
class: "swiper-button-prev",
|
|
208
172
|
"data-cy": "swiper-button-prev",
|
|
209
|
-
onClick:
|
|
173
|
+
onClick: s[2] || (s[2] = O(() => {
|
|
210
174
|
}, ["stop"]))
|
|
211
175
|
}),
|
|
212
|
-
|
|
176
|
+
p("div", {
|
|
213
177
|
class: "swiper-button-next",
|
|
214
178
|
"data-cy": "swiper-button-next",
|
|
215
|
-
onClick:
|
|
179
|
+
onClick: s[3] || (s[3] = O(() => {
|
|
216
180
|
}, ["stop"]))
|
|
217
181
|
})
|
|
218
|
-
], 64)) :
|
|
219
|
-
], 10,
|
|
220
|
-
|
|
182
|
+
], 64)) : b("", !0)
|
|
183
|
+
], 10, de),
|
|
184
|
+
t.thumbSwiperOptions ? (l(), n("div", {
|
|
221
185
|
key: 0,
|
|
222
|
-
|
|
223
|
-
thumbsSlider: "",
|
|
186
|
+
ref: "thumbsRef",
|
|
224
187
|
class: d(["swiper", e.$attrs["thumb-swiper-classes"]])
|
|
225
188
|
}, [
|
|
226
|
-
|
|
189
|
+
p("div", {
|
|
227
190
|
class: d(["swiper-wrapper", e.$attrs["thumb-swiper-wrapper-classes"]])
|
|
228
191
|
}, [
|
|
229
|
-
(
|
|
230
|
-
key: `thumb_${
|
|
192
|
+
(l(!0), n(k, null, L(t.images, (i, r) => (l(), n("div", {
|
|
193
|
+
key: `thumb_${$.value}_${r}`,
|
|
231
194
|
class: d(["swiper-slide", e.$attrs["thumb-img-wrapper-classes"]])
|
|
232
195
|
}, [
|
|
233
|
-
|
|
196
|
+
p("img", V({
|
|
234
197
|
class: e.$attrs["thumb-img-classes"]
|
|
235
|
-
}, { ref_for: !0 },
|
|
236
|
-
alt:
|
|
237
|
-
}), null, 16,
|
|
198
|
+
}, { ref_for: !0 }, P(i, -1, !1), {
|
|
199
|
+
alt: i.alt
|
|
200
|
+
}), null, 16, ce)
|
|
238
201
|
], 2))), 128))
|
|
239
202
|
], 2)
|
|
240
|
-
],
|
|
241
|
-
],
|
|
203
|
+
], 2)) : b("", !0)
|
|
204
|
+
], 2));
|
|
242
205
|
}
|
|
243
206
|
});
|
|
244
207
|
export {
|
|
245
|
-
|
|
208
|
+
ke as default
|
|
246
209
|
};
|
package/package.json
CHANGED
package/dist/Swiper/autoplay.js
DELETED
package/dist/Swiper/free-mode.js
DELETED
package/dist/Swiper/keyboard.js
DELETED
package/dist/Swiper/thumbs.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ChartOptions, ChartType } from 'chart.js';
|
|
2
|
-
export declare const useChartJsModules: <T extends ChartType = ChartType>(options: ChartOptions<T>) => {
|
|
3
|
-
registerTitle: () => Promise<void>;
|
|
4
|
-
registerLegend: () => Promise<void>;
|
|
5
|
-
registerTooltip: () => Promise<void>;
|
|
6
|
-
registerTimeCartesianAxis: () => Promise<void>;
|
|
7
|
-
executeRegistration: (...args: (() => Promise<unknown>)[]) => Promise<void>;
|
|
8
|
-
registerPlugins: () => Promise<void>;
|
|
9
|
-
resolved: import('vue').Ref<boolean, boolean>;
|
|
10
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { computed as t, ref as f } from "vue";
|
|
2
|
-
import { Chart as r, TimeScale as d, Tooltip as T, Legend as h, Title as w } from "chart.js";
|
|
3
|
-
import "chartjs-adapter-date-fns";
|
|
4
|
-
const L = (e) => {
|
|
5
|
-
if (!e) throw Error("Options must be defined");
|
|
6
|
-
const l = t(
|
|
7
|
-
() => !!e.plugins?.tooltip
|
|
8
|
-
), o = t(
|
|
9
|
-
() => e.scales?.x?.type === "time"
|
|
10
|
-
), c = t(() => !!e.plugins?.title), u = t(
|
|
11
|
-
() => !!e.plugins?.legend
|
|
12
|
-
), i = async () => {
|
|
13
|
-
l.value && r.register(T);
|
|
14
|
-
}, g = async () => {
|
|
15
|
-
o.value && r.register(d);
|
|
16
|
-
}, s = async () => {
|
|
17
|
-
c.value && r.register(w);
|
|
18
|
-
}, n = async () => {
|
|
19
|
-
u.value && r.register(h);
|
|
20
|
-
}, a = f(!1);
|
|
21
|
-
return {
|
|
22
|
-
registerTitle: s,
|
|
23
|
-
registerLegend: n,
|
|
24
|
-
registerTooltip: i,
|
|
25
|
-
registerTimeCartesianAxis: g,
|
|
26
|
-
executeRegistration: async (...m) => {
|
|
27
|
-
await Promise.all(m.map((p) => p())), a.value = !0;
|
|
28
|
-
},
|
|
29
|
-
registerPlugins: async () => {
|
|
30
|
-
await Promise.all([i(), s(), n()]);
|
|
31
|
-
},
|
|
32
|
-
resolved: a
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
export {
|
|
36
|
-
L as useChartJsModules
|
|
37
|
-
};
|
|
File without changes
|