@wikicasa-dev/components 1.6.6 → 1.6.7

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.
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./chunks/DoughnutChart.vue_vue_type_script_setup_true_lang.COJ2g3Ru.js";
1
+ import { _ as f } from "./chunks/DoughnutChart.vue_vue_type_script_setup_true_lang.C4QPaUsI.js";
2
2
  export {
3
3
  f as default
4
4
  };
package/dist/LineChart.js CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./chunks/LineChart.vue_vue_type_script_setup_true_lang.Xxk1Ei4U.js";
1
+ import { _ as f } from "./chunks/LineChart.vue_vue_type_script_setup_true_lang.D1HsyTJq.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,7 +1,10 @@
1
1
  import type { ChartOptions } from "chart.js";
2
2
  export declare const useChartJsModules: <T extends keyof import("chart.js").ChartTypeRegistry = keyof import("chart.js").ChartTypeRegistry>(options: ChartOptions<T>) => {
3
+ registerTitle: () => Promise<void>;
4
+ registerLegend: () => Promise<void>;
3
5
  registerTooltip: () => Promise<void>;
4
6
  registerTimeCartesianAxis: () => Promise<void>;
5
- registerModules: (...args: Promise<unknown>[]) => Promise<void>;
7
+ executeRegistration: (...args: (() => Promise<unknown>)[]) => Promise<void>;
8
+ registerPlugins: () => Promise<void>;
6
9
  resolved: import("vue").Ref<boolean>;
7
10
  };
@@ -0,0 +1,27 @@
1
+ import { defineComponent as i, onBeforeMount as p, unref as t, openBlock as u, createBlock as m, createCommentVNode as c } from "vue";
2
+ import { Doughnut as l } from "vue-chartjs";
3
+ import { Chart as d, DoughnutController as f, ArcElement as g } from "chart.js";
4
+ import { useChartJsModules as h } from "../useChartjsModules.js";
5
+ const y = /* @__PURE__ */ i({
6
+ __name: "DoughnutChart",
7
+ props: {
8
+ options: {},
9
+ data: {}
10
+ },
11
+ setup(e) {
12
+ d.register(f, g);
13
+ const r = e, { registerPlugins: n, resolved: s, executeRegistration: a } = h(
14
+ r.options
15
+ );
16
+ return p(async () => {
17
+ await a(n);
18
+ }), (o, C) => t(s) ? (u(), m(t(l), {
19
+ key: 0,
20
+ options: o.options,
21
+ data: o.data
22
+ }, null, 8, ["options", "data"])) : c("", !0);
23
+ }
24
+ });
25
+ export {
26
+ y as _
27
+ };
@@ -1,8 +1,8 @@
1
- import { defineComponent as p, onBeforeMount as m, unref as o, openBlock as l, createBlock as c, createCommentVNode as u } from "vue";
1
+ import { defineComponent as p, onBeforeMount as m, unref as o, openBlock as c, createBlock as l, createCommentVNode as u } from "vue";
2
2
  import { Line as d } from "vue-chartjs";
3
3
  import { Chart as f, LineController as C, LineElement as g, PointElement as L, CategoryScale as _, LinearScale as h } from "chart.js";
4
4
  import { useChartJsModules as k } from "../useChartjsModules.js";
5
- const T = /* @__PURE__ */ p({
5
+ const P = /* @__PURE__ */ p({
6
6
  __name: "LineChart",
7
7
  props: {
8
8
  options: {},
@@ -17,14 +17,14 @@ const T = /* @__PURE__ */ p({
17
17
  h
18
18
  );
19
19
  const r = t, {
20
- registerTooltip: n,
21
- registerTimeCartesianAxis: i,
22
- registerModules: s,
23
- resolved: a
20
+ registerPlugins: n,
21
+ registerTimeCartesianAxis: a,
22
+ executeRegistration: i,
23
+ resolved: s
24
24
  } = k(r.options);
25
25
  return m(async () => {
26
- s(n(), i());
27
- }), (e, y) => o(a) ? (l(), c(o(d), {
26
+ await i(n, a);
27
+ }), (e, y) => o(s) ? (c(), l(o(d), {
28
28
  key: 0,
29
29
  options: e.options,
30
30
  data: e.data
@@ -32,5 +32,5 @@ const T = /* @__PURE__ */ p({
32
32
  }
33
33
  });
34
34
  export {
35
- T as _
35
+ P as _
36
36
  };
package/dist/index.js CHANGED
@@ -30,8 +30,8 @@ import { default as ae } from "./BaseTooltip.js";
30
30
  import { _ as te } from "./chunks/BaseUploadFile.vue_vue_type_script_setup_true_lang.1Uo4HnFM.js";
31
31
  import { default as fe } from "./BaseModal.js";
32
32
  import { default as me } from "./BaseSnackbar.js";
33
- import { _ as le } from "./chunks/DoughnutChart.vue_vue_type_script_setup_true_lang.COJ2g3Ru.js";
34
- import { _ as de } from "./chunks/LineChart.vue_vue_type_script_setup_true_lang.Xxk1Ei4U.js";
33
+ import { _ as le } from "./chunks/DoughnutChart.vue_vue_type_script_setup_true_lang.C4QPaUsI.js";
34
+ import { _ as de } from "./chunks/LineChart.vue_vue_type_script_setup_true_lang.D1HsyTJq.js";
35
35
  import { _ as ne } from "./chunks/IntersectionObservable.vue_vue_type_script_setup_true_lang.BBMxY-re.js";
36
36
  import { _ as ie } from "./chunks/IntersectionObserver.vue_vue_type_script_setup_true_lang.CQHjzQc3.js";
37
37
  import { _ as be } from "./chunks/SwiperCarousel.vue_vue_type_style_index_0_lang.CBBHq8Cf.js";
@@ -1,36 +1,53 @@
1
- import { computed as i, ref as c } from "vue";
2
- import { Chart as s } from "chart.js";
3
- const f = (t) => {
1
+ import { computed as i, ref as w } from "vue";
2
+ import { Chart as r } from "chart.js";
3
+ const y = (t) => {
4
4
  if (!t)
5
5
  throw Error("Options must be defined");
6
- const o = i(
6
+ const c = i(
7
7
  () => !!t.plugins?.tooltip
8
- ), a = i(
8
+ ), u = i(
9
9
  () => t.scales?.x?.type === "time"
10
- ), l = async () => {
11
- if (!o.value)
10
+ ), g = i(() => !!t.plugins?.title), m = i(
11
+ () => !!t.plugins?.legend
12
+ ), a = async () => {
13
+ if (!c.value)
12
14
  return;
13
15
  const { Tooltip: e } = await import("chart.js");
14
- s.register(e);
15
- }, n = async () => {
16
- if (!a.value)
16
+ r.register(e);
17
+ }, p = async () => {
18
+ if (!u.value)
17
19
  return;
18
- const [e, m] = await Promise.all([
20
+ const [e, s] = await Promise.all([
19
21
  //@ts-ignore
20
22
  import("chartjs-adapter-date-fns"),
21
23
  import("chart.js")
22
24
  ]);
23
- s.register(m.TimeScale);
24
- }, r = c(!1);
25
+ r.register(s.TimeScale);
26
+ }, n = async () => {
27
+ if (!g.value)
28
+ return;
29
+ const { Title: e } = await import("chart.js");
30
+ r.register(e);
31
+ }, o = async () => {
32
+ if (!m.value)
33
+ return;
34
+ const { Legend: e } = await import("chart.js");
35
+ r.register(e);
36
+ }, l = w(!1);
25
37
  return {
26
- registerTooltip: l,
27
- registerTimeCartesianAxis: n,
28
- registerModules: async (...e) => {
29
- await Promise.all(e), r.value = !0;
38
+ registerTitle: n,
39
+ registerLegend: o,
40
+ registerTooltip: a,
41
+ registerTimeCartesianAxis: p,
42
+ executeRegistration: async (...e) => {
43
+ await Promise.all(e.map((s) => s())), l.value = !0;
44
+ },
45
+ registerPlugins: async () => {
46
+ await Promise.all([a(), n(), o()]);
30
47
  },
31
- resolved: r
48
+ resolved: l
32
49
  };
33
50
  };
34
51
  export {
35
- f as useChartJsModules
52
+ y as useChartJsModules
36
53
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikicasa-dev/components",
3
- "version": "1.6.6",
3
+ "version": "1.6.7",
4
4
  "description": "Wikicasa frontend components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,27 +0,0 @@
1
- import { defineComponent as p, onBeforeMount as i, unref as t, openBlock as u, createBlock as m, createCommentVNode as c } from "vue";
2
- import { Doughnut as l } from "vue-chartjs";
3
- import { Chart as d, DoughnutController as f, ArcElement as h } from "chart.js";
4
- import { useChartJsModules as g } from "../useChartjsModules.js";
5
- const M = /* @__PURE__ */ p({
6
- __name: "DoughnutChart",
7
- props: {
8
- options: {},
9
- data: {}
10
- },
11
- setup(e) {
12
- d.register(f, h);
13
- const r = e, { registerTooltip: n, registerModules: s, resolved: a } = g(
14
- r.options
15
- );
16
- return i(async () => {
17
- await s(n());
18
- }), (o, C) => t(a) ? (u(), m(t(l), {
19
- key: 0,
20
- options: o.options,
21
- data: o.data
22
- }, null, 8, ["options", "data"])) : c("", !0);
23
- }
24
- });
25
- export {
26
- M as _
27
- };