vue-chrts 1.0.0-test.1 → 1.0.0-test.2

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,12 +1,12 @@
1
- import { defineComponent as L, useSlots as B, useTemplateRef as P, ref as T, computed as i, createElementBlock as g, openBlock as m, normalizeStyle as a, createVNode as s, createCommentVNode as f, renderSlot as u, createElementVNode as d, unref as r, withCtx as W, toDisplayString as w } from "vue";
1
+ import { defineComponent as T, useSlots as B, useTemplateRef as P, ref as W, computed as c, createElementBlock as f, openBlock as m, normalizeStyle as s, createVNode as a, createCommentVNode as v, createElementVNode as i, unref as l, withCtx as _, renderSlot as p, toDisplayString as b } from "vue";
2
2
  import { Donut as R } from "@unovis/ts";
3
- import { DonutType as j } from "./types.js";
4
- import { VisSingleContainer as H, VisTooltip as N, VisDonut as $, VisBulletLegend as z } from "@unovis/vue";
3
+ import { DonutType as z } from "./types.js";
4
+ import { VisSingleContainer as H, VisTooltip as N, VisDonut as $, VisBulletLegend as j } from "@unovis/vue";
5
5
  import { LegendPosition as E } from "../../types.js";
6
- const O = {
6
+ const M = { class: "absolute top-1/2 left-1/2 -translate-1/2" }, O = {
7
7
  ref: "slotWrapper",
8
8
  style: { display: "none" }
9
- }, _ = { style: { display: "flex", "align-items": "center", padding: "10px 15px" } }, G = /* @__PURE__ */ L({
9
+ }, U = { style: { display: "flex", "align-items": "center", padding: "10px 15px" } }, K = /* @__PURE__ */ T({
10
10
  __name: "DonutChart",
11
11
  props: {
12
12
  type: {},
@@ -21,95 +21,97 @@ const O = {
21
21
  padAngle: {}
22
22
  },
23
23
  emits: ["click"],
24
- setup(v, { emit: y }) {
25
- const h = y, t = v, k = B(), C = P("slotWrapper"), l = T(), V = (e) => e, b = t.type === j.Half, c = i(
26
- () => Object.values(t.categories).map((e) => {
27
- const o = e.color;
28
- return Array.isArray(o) ? o[0] : o ?? "#3b82f6";
29
- })
30
- ), x = i(
31
- () => Object.values(t.categories).map((e) => ({
32
- ...e,
33
- color: Array.isArray(e.color) ? e.color[0] : e.color ?? "#3b82f6"
34
- }))
35
- );
36
- function A(e) {
37
- l.value = e;
24
+ setup(h, { emit: y }) {
25
+ const C = y, n = h, k = B(), g = P("slotWrapper"), r = W(), V = (e) => e, x = n.type === z.Half;
26
+ function S(e) {
27
+ return r.value = e, w();
38
28
  }
39
- const S = i(() => t.legendPosition.includes("top")), D = i(() => t.legendPosition.includes("left") ? "flex-start" : t.legendPosition.includes("right") ? "flex-end" : "center");
40
- return (e, o) => (m(), g("div", {
41
- style: a({
29
+ function w(e) {
30
+ return typeof window > "u" ? "" : g.value ? g.value.innerHTML : "";
31
+ }
32
+ const A = c(() => n.legendPosition.includes("top")), D = c(() => n.legendPosition.includes("left") ? "flex-start" : n.legendPosition.includes("right") ? "flex-end" : "center"), d = (e, o = "#ccc") => e ? Array.isArray(e) ? e[0] || o : e : o, u = c(() => Object.values(n.categories)), L = (e, o) => {
33
+ const t = u.value[o];
34
+ if (t)
35
+ return d(t.color);
36
+ };
37
+ return (e, o) => (m(), f("div", {
38
+ style: s({
42
39
  display: "flex",
43
- flexDirection: S.value ? "column-reverse" : "column",
40
+ flexDirection: A.value ? "column-reverse" : "column",
44
41
  gap: "var(--vis-legend-spacing)"
45
42
  }),
46
- onClick: o[0] || (o[0] = (n) => h("click", n, l.value))
43
+ onClick: o[0] || (o[0] = (t) => C("click", t, r.value))
47
44
  }, [
48
- s(r(H), {
45
+ a(l(H), {
49
46
  data: e.data,
50
47
  height: e.height,
51
48
  margin: {}
52
49
  }, {
53
- default: W(() => [
54
- s(r(N), {
50
+ default: _(() => [
51
+ a(l(N), {
55
52
  "horizontal-shift": 20,
56
53
  "vertical-shift": 20,
57
54
  triggers: {
58
- [r(R).selectors.segment]: (n) => {
59
- var p;
60
- return A(n), n ? (p = C.value) == null ? void 0 : p.innerHTML : "";
61
- }
55
+ [l(R).selectors.segment]: S
62
56
  }
63
57
  }, null, 8, ["triggers"]),
64
- s(r($), {
58
+ a(l($), {
65
59
  value: V,
66
60
  "corner-radius": e.radius,
67
61
  "arc-width": e.arcWidth ?? 20,
68
- color: c.value,
69
- "angle-range": b ? [-1.5707963267948966, 1.5707963267948966] : [],
70
- "pad-angle": t.padAngle || 0
71
- }, null, 8, ["corner-radius", "arc-width", "color", "angle-range", "pad-angle"])
62
+ color: L,
63
+ "angle-range": x ? [-1.5707963267948966, 1.5707963267948966] : [],
64
+ "pad-angle": n.padAngle || 0
65
+ }, null, 8, ["corner-radius", "arc-width", "angle-range", "pad-angle"]),
66
+ i("div", M, [
67
+ p(e.$slots, "default")
68
+ ])
72
69
  ]),
73
- _: 1
70
+ _: 3
74
71
  }, 8, ["data", "height"]),
75
- t.hideLegend ? f("", !0) : (m(), g("div", {
72
+ n.hideLegend ? v("", !0) : (m(), f("div", {
76
73
  key: 0,
77
- style: a({
74
+ style: s({
78
75
  display: "flex",
79
76
  justifyContent: D.value
80
77
  })
81
78
  }, [
82
- s(r(z), {
83
- style: a([
84
- t.legendStyle,
79
+ a(l(j), {
80
+ style: s([
81
+ n.legendStyle,
85
82
  "display: flex; gap: var(--vis-legend-spacing);"
86
83
  ]),
87
- items: x.value
84
+ items: u.value.map((t) => ({
85
+ ...t,
86
+ color: d(t.color)
87
+ }))
88
88
  }, null, 8, ["style", "items"])
89
89
  ], 4)),
90
- u(e.$slots, "default"),
91
- d("div", O, [
92
- r(k).tooltip ? u(e.$slots, "tooltip", {
90
+ i("div", O, [
91
+ l(k).tooltip ? p(e.$slots, "tooltip", {
93
92
  key: 0,
94
- values: l.value
95
- }) : l.value ? u(e.$slots, "fallback", { key: 1 }, () => [
96
- d("div", _, [
97
- d("div", {
98
- style: a({
99
- width: "0.5rem",
100
- height: "0.5rem",
101
- borderRadius: "9999px",
102
- marginRight: "0.5rem",
103
- backgroundColor: c.value[l.value.index]
104
- })
105
- }, null, 4),
106
- d("div", null, w(l.value.data), 1)
107
- ])
108
- ]) : f("", !0)
93
+ values: r.value
94
+ }) : r.value ? p(e.$slots, "fallback", { key: 1 }, () => {
95
+ var t;
96
+ return [
97
+ i("div", U, [
98
+ i("div", {
99
+ style: s({
100
+ width: "0.5rem",
101
+ height: "0.5rem",
102
+ borderRadius: "9999px",
103
+ marginRight: "0.5rem",
104
+ backgroundColor: d((t = u.value[r.value.index]) == null ? void 0 : t.color)
105
+ })
106
+ }, null, 4),
107
+ i("div", null, b(r.value.data), 1)
108
+ ])
109
+ ];
110
+ }) : v("", !0)
109
111
  ], 512)
110
112
  ], 4));
111
113
  }
112
114
  });
113
115
  export {
114
- G as default
116
+ K as default
115
117
  };
@@ -1,5 +1,5 @@
1
1
  import { DonutChartProps } from './types';
2
- declare const _default: <T extends Record<string, any> = any>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
2
+ declare const _default: <T extends {}>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
3
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
4
4
  readonly onClick?: ((event: MouseEvent, values?: any) => any) | undefined;
5
5
  } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onClick"> & DonutChartProps & Partial<{}>> & import('vue').PublicProps;
@@ -2,10 +2,10 @@ import { defineComponent as V, useSlots as B, useTemplateRef as w, ref as A, com
2
2
  import { Timeline as y } from "@unovis/ts";
3
3
  import { dateFormatter as S, getFirstPropertyValue as N } from "../../utils.js";
4
4
  import j from "../Tooltip.js";
5
- import { VisXYContainer as O, VisTimeline as $, VisTooltip as D, VisAxis as M, VisBulletLegend as E } from "@unovis/vue";
6
- import { LegendPosition as G } from "../../types.js";
5
+ import { VisXYContainer as O, VisTimeline as $, VisTooltip as D, VisAxis as G, VisBulletLegend as M } from "@unovis/vue";
6
+ import { LegendPosition as E } from "../../types.js";
7
7
  const I = /* @__PURE__ */ V({
8
- __name: "Timeline",
8
+ __name: "GanttChart",
9
9
  props: {
10
10
  data: {},
11
11
  labelWidth: { default: 220 },
@@ -22,7 +22,7 @@ const I = /* @__PURE__ */ V({
22
22
  crosshairConfig: {},
23
23
  lineWidth: { default: 12 },
24
24
  rowHeight: { default: 24 },
25
- legendPosition: { default: G.TopRight },
25
+ legendPosition: { default: E.TopRight },
26
26
  legendStyle: {},
27
27
  hideLegend: { type: Boolean },
28
28
  xTickLine: { type: Boolean },
@@ -44,10 +44,10 @@ const I = /* @__PURE__ */ V({
44
44
  function L(e, a, t) {
45
45
  r("click", t, { index: a, item: e });
46
46
  }
47
- function W(e) {
47
+ function C(e) {
48
48
  r("scroll", e.deltaY);
49
49
  }
50
- const C = s(() => {
50
+ const W = s(() => {
51
51
  const e = Object.values(l.categories).map(
52
52
  (a, t) => `var(--vis-color${t})`
53
53
  );
@@ -65,7 +65,7 @@ const I = /* @__PURE__ */ V({
65
65
  o(i(O), {
66
66
  data: l.data,
67
67
  height: l.height,
68
- onWheel: W
68
+ onWheel: C
69
69
  }, {
70
70
  default: P(() => [
71
71
  o(i($), {
@@ -74,7 +74,7 @@ const I = /* @__PURE__ */ V({
74
74
  lineWidth: l.lineWidth,
75
75
  rowHeight: l.rowHeight,
76
76
  type: l.type,
77
- color: C.value,
77
+ color: W.value,
78
78
  labelWidth: l.labelWidth,
79
79
  showLabels: l.showLabels,
80
80
  onClick: L
@@ -87,7 +87,7 @@ const I = /* @__PURE__ */ V({
87
87
  }
88
88
  }
89
89
  }, null, 8, ["triggers"]),
90
- o(i(M), F({
90
+ o(i(G), F({
91
91
  type: "x",
92
92
  tickFormat: e.xTickFormat || i(S),
93
93
  numTicks: e.xNumTicks,
@@ -105,7 +105,7 @@ const I = /* @__PURE__ */ V({
105
105
  justifyContent: b.value
106
106
  })
107
107
  }, [
108
- o(i(E), {
108
+ o(i(M), {
109
109
  style: c([
110
110
  l.legendStyle,
111
111
  "display: flex; gap: var(--vis-legend-spacing);"
@@ -1,4 +1,4 @@
1
- import { TimelineProps } from '../../types';
1
+ import { GanttChartProps } from '../../types';
2
2
  export interface TimelineCategory {
3
3
  name: string;
4
4
  color?: string | string[];
@@ -11,7 +11,7 @@ declare const _default: <T extends Record<string, any>>(__VLS_props: NonNullable
11
11
  }) => any) | undefined;
12
12
  readonly onScroll?: ((distance: number) => any) | undefined;
13
13
  readonly onLabelHover?: ((item: T | undefined) => any) | undefined;
14
- } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onClick" | "onScroll" | "onLabelHover"> & TimelineProps<T> & Partial<{}>> & import('vue').PublicProps;
14
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onClick" | "onScroll" | "onLabelHover"> & GanttChartProps<T> & Partial<{}>> & import('vue').PublicProps;
15
15
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
16
16
  attrs: any;
17
17
  slots: {
@@ -0,0 +1,4 @@
1
+ import f from "./GanttChart.js";
2
+ export {
3
+ f as default
4
+ };
@@ -1,9 +1,5 @@
1
1
  import { BulletLegendItemInterface, CrosshairConfig, LegendPosition, AxisConfig } from '../../types';
2
- export interface TimelineLegendItem {
3
- name: string;
4
- color: string;
5
- }
6
- export interface TimelineProps<T> {
2
+ export interface GanttChartProps<T> {
7
3
  /**
8
4
  * The data to be displayed in the timeline chart.
9
5
  * Each element of the array represents a timeline event or item.
@@ -1,7 +1,6 @@
1
- import { defineComponent as a, createBlock as r, openBlock as s, mergeProps as p, createSlots as l, renderList as y, withCtx as c, renderSlot as m, normalizeProps as d, guardReactiveProps as x } from "vue";
2
- import h from "../AreaChart/AreaChart.js";
3
- const L = /* @__PURE__ */ a({
4
- inheritAttrs: !1,
1
+ import { defineComponent as t, useSlots as a, createBlock as r, openBlock as l, mergeProps as p, createSlots as s, withCtx as y, renderSlot as c, normalizeProps as m, guardReactiveProps as d } from "vue";
2
+ import x from "../AreaChart/AreaChart.js";
3
+ const u = /* @__PURE__ */ t({
5
4
  __name: "LineChart",
6
5
  props: {
7
6
  data: {},
@@ -38,18 +37,19 @@ const L = /* @__PURE__ */ a({
38
37
  yDomain: {},
39
38
  xDomain: {}
40
39
  },
41
- setup(i) {
42
- const n = i;
43
- return (e, B) => (s(), r(h, p(n, { "hide-area": !0 }), l({ _: 2 }, [
44
- y(e.$slots, (f, o) => ({
45
- name: o,
46
- fn: c((t) => [
47
- m(e.$slots, o, d(x(t)))
48
- ])
49
- }))
40
+ setup(o) {
41
+ const i = o;
42
+ return a(), (e, h) => (l(), r(x, p(i, { "hide-area": !0 }), s({ _: 2 }, [
43
+ e.$slots.tooltip ? {
44
+ name: "tooltip",
45
+ fn: y((n) => [
46
+ c(e.$slots, "tooltip", m(d(n)))
47
+ ]),
48
+ key: "0"
49
+ } : void 0
50
50
  ]), 1040));
51
51
  }
52
52
  });
53
53
  export {
54
- L as default
54
+ u as default
55
55
  };
@@ -3,7 +3,15 @@ declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>
3
3
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & LineChartProps<T> & Partial<{}>> & import('vue').PublicProps;
4
4
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
5
5
  attrs: any;
6
- slots: Partial<Record<number, (_: any) => any>>;
6
+ slots: Readonly<{
7
+ tooltip?: (props: {
8
+ values: T | undefined;
9
+ }) => any;
10
+ }> & {
11
+ tooltip?: (props: {
12
+ values: T | undefined;
13
+ }) => any;
14
+ };
7
15
  emit: {};
8
16
  }>) => import('vue').VNode & {
9
17
  __ctx?: Awaited<typeof __VLS_setup>;
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { default as LineChart } from './components/LineChart/LineChart.vue';
3
3
  import { default as BarChart } from './components/BarChart/BarChart.vue';
4
4
  import { default as DonutChart } from './components/DonutChart/DonutChart.vue';
5
5
  import { default as BubbleChart } from './components/BubbleChart/BubbleChart.vue';
6
- import { default as Timeline } from './components/Timeline/Timeline.vue';
6
+ import { default as GanttChart } from './components/GanttChart/GanttChart.vue';
7
7
  import { LegendPosition, CurveType, Orientation, BulletLegendItemInterface, MarkerConfig, CrosshairConfig } from './types';
8
- export { AreaChart, LineChart, BarChart, DonutChart, BubbleChart, Timeline, Orientation, CurveType, LegendPosition };
8
+ export { AreaChart, LineChart, BarChart, DonutChart, BubbleChart, GanttChart, Orientation, CurveType, LegendPosition };
9
9
  export type { BulletLegendItemInterface, MarkerConfig, CrosshairConfig };
package/dist/index.js CHANGED
@@ -1,18 +1,18 @@
1
- import { default as t } from "./components/AreaChart/AreaChart.js";
1
+ import { default as a } from "./components/AreaChart/AreaChart.js";
2
2
  import { default as o } from "./components/LineChart/LineChart.js";
3
3
  import { default as u } from "./components/BarChart/BarChart.js";
4
- import { default as m } from "./components/DonutChart/DonutChart.js";
5
- import { default as d } from "./components/BubbleChart/BubbleChart.js";
6
- import { default as n } from "./components/Timeline/Timeline.js";
7
- import { CurveType as x, LegendPosition as C, Orientation as h } from "./types.js";
4
+ import { default as d } from "./components/DonutChart/DonutChart.js";
5
+ import { default as m } from "./components/BubbleChart/BubbleChart.js";
6
+ import { default as s } from "./components/GanttChart/GanttChart.js";
7
+ import { CurveType as C, LegendPosition as h, Orientation as i } from "./types.js";
8
8
  export {
9
- t as AreaChart,
9
+ a as AreaChart,
10
10
  u as BarChart,
11
- d as BubbleChart,
12
- x as CurveType,
13
- m as DonutChart,
14
- C as LegendPosition,
11
+ m as BubbleChart,
12
+ C as CurveType,
13
+ d as DonutChart,
14
+ s as GanttChart,
15
+ h as LegendPosition,
15
16
  o as LineChart,
16
- h as Orientation,
17
- n as Timeline
17
+ i as Orientation
18
18
  };
package/dist/types.d.ts CHANGED
@@ -3,7 +3,7 @@ import { BarChartProps } from './components/BarChart/types';
3
3
  import { LineChartProps } from './components/LineChart/types';
4
4
  import { DonutChartProps } from './components/DonutChart/types';
5
5
  import { BubbleChartProps } from './components/BubbleChart/types';
6
- import { TimelineProps, TimelineLegendItem } from './components/Timeline/types';
6
+ import { GanttChartProps } from './components/GanttChart/types';
7
7
  declare enum LegendPosition {
8
8
  TopLeft = "top-left",
9
9
  TopCenter = "top-center",
@@ -44,7 +44,7 @@ declare enum Orientation {
44
44
  Horizontal = "horizontal",
45
45
  Vertical = "vertical"
46
46
  }
47
- export { LegendPosition, CurveType, Orientation, type AreaChartProps, type BarChartProps, type LineChartProps, type DonutChartProps, type BulletLegendItemInterface, type BubbleChartProps, type TimelineProps, type TimelineLegendItem };
47
+ export { LegendPosition, CurveType, Orientation, type AreaChartProps, type BarChartProps, type LineChartProps, type DonutChartProps, type BulletLegendItemInterface, type BubbleChartProps, type GanttChartProps, };
48
48
  export type axisFormatter = ((tick: number, i?: number, ticks?: number[]) => string) | ((tick: Date, i?: number, ticks?: Date[]) => string);
49
49
  export interface AxisConfig {
50
50
  tickLine?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-chrts",
3
- "version": "1.0.0-test.1",
3
+ "version": "1.0.0-test.2",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -1,4 +0,0 @@
1
- import f from "./Timeline.js";
2
- export {
3
- f as default
4
- };