UNPKG

maz-ui

Version:

A standalone components library for Vue.Js 3 & Nuxt.Js 3

99 lines (98 loc) 2.37 kB
import { defineComponent as l, defineAsyncComponent as d, openBlock as m, createBlock as y, resolveDynamicComponent as f, unref as g, mergeProps as b } from "vue"; import { Chart as h, CategoryScale as C, LinearScale as S, Title as _, Tooltip as A, Legend as B, BarElement as E, ArcElement as L, PointElement as P, LineElement as j } from "chart.js"; const v = /* @__PURE__ */ l({ __name: "MazChart", props: { /** * Chart.js chart type */ type: { type: String, required: !0 }, /** * The data object that is passed into the Chart.js chart * @see https://www.chartjs.org/docs/latest/getting-started/ */ data: { type: Object, required: !0 }, /** * The options object that is passed into the Chart.js chart * @see https://www.chartjs.org/docs/latest/general/options.html */ options: { type: Object, default: () => ({}) }, /** * The plugins array that is passed into the Chart.js chart * @see https://www.chartjs.org/docs/latest/developers/plugins.html */ plugins: { type: Array, default: () => [] }, /** * Key name to identificate dataset */ datasetIdKey: { type: String, default: "label" }, /** * A mode string to indicate transition configuration should be used. * @see https://www.chartjs.org/docs/latest/developers/api.html#update-mode */ updateMode: { type: String, default: void 0 } }, setup(a) { const e = a; h.register( C, S, _, A, B, E, L, P, j ); const n = d(async () => { const { Bar: t, Bubble: r, Doughnut: o, Line: c, Pie: s, PolarArea: u, Radar: p, Scatter: i } = await import("vue-chartjs"); switch (e.type) { case "bar": return t; case "line": return c; case "scatter": return i; case "bubble": return r; case "pie": return s; case "doughnut": return o; case "polarArea": return u; case "radar": return p; } }); return (t, r) => (m(), y( f(g(n)), b({ class: "m-chart m-reset-css" }, e), null, 16 /* FULL_PROPS */ )); } }); export { v as default };