adverich-kun-ui 0.1.308 → 0.1.310

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,5 +1,5 @@
1
- import { computed as i, createElementBlock as o, openBlock as r, renderSlot as s, createCommentVNode as n, mergeProps as d, toDisplayString as u } from "vue";
2
- const f = { class: "relative inline-block" }, p = { key: 0 }, m = /* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
1
+ import { computed as l, createElementBlock as i, openBlock as a, renderSlot as u, createCommentVNode as s, mergeProps as d, toDisplayString as p } from "vue";
2
+ const m = { class: "relative inline-block" }, g = { key: 0 }, y = /* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
3
3
  __name: "KunBadge",
4
4
  props: {
5
5
  text: { type: [String, Number], default: "" },
@@ -9,32 +9,76 @@ const f = { class: "relative inline-block" }, p = { key: 0 }, m = /* @__PURE__ *
9
9
  fontWeight: { type: String, default: "font-bold" },
10
10
  rounded: { type: String, default: "rounded-full" },
11
11
  dot: { type: Boolean, default: !1 },
12
- // Modo punto
13
- visible: { type: Boolean, default: !0 }
14
- // Mostrar u ocultar
12
+ visible: { type: Boolean, default: !0 },
13
+ position: {
14
+ type: String,
15
+ default: "top right",
16
+ validator: (t) => [
17
+ "top left",
18
+ "top center",
19
+ "top right",
20
+ "center left",
21
+ "center center",
22
+ "center right",
23
+ "bottom left",
24
+ "bottom center",
25
+ "bottom right"
26
+ ].includes(t)
27
+ },
28
+ ejeX: { type: Number, default: 0 },
29
+ // desplazamiento horizontal
30
+ ejeY: { type: Number, default: 0 }
31
+ // desplazamiento vertical
15
32
  },
16
- setup(e) {
17
- const t = e, a = i(() => [
33
+ setup(t) {
34
+ const e = t;
35
+ l(() => [
18
36
  "absolute -top-1 -right-1 flex items-center justify-center px-2 py-1",
19
37
  "transform translate-x-1/2 -translate-y-1/2",
20
38
  "min-w-[20px] min-h-[20px]",
21
- t.bgColor,
22
- t.textColor,
23
- t.textSize,
24
- t.fontWeight,
25
- t.rounded
39
+ e.bgColor,
40
+ e.textColor,
41
+ e.textSize,
42
+ e.fontWeight,
43
+ e.rounded
26
44
  ].filter(Boolean));
27
- return (l, c) => (r(), o("div", f, [
28
- s(l.$slots, "default"),
29
- e.visible ? (r(), o("div", d({
45
+ const c = l(() => {
46
+ const o = {
47
+ top: "top-0",
48
+ center: "top-1/2",
49
+ bottom: "bottom-0",
50
+ left: "left-0",
51
+ right: "right-0",
52
+ "center-x": "left-1/2",
53
+ "center-y": "top-1/2"
54
+ }, [n, r] = e.position.split(" ");
55
+ return [
56
+ o[n] || "",
57
+ r === "center" ? "left-1/2" : o[r],
58
+ n === "center" ? "top-1/2" : "",
59
+ "absolute",
60
+ "transform",
61
+ r === "center" ? "-translate-x-1/2" : "",
62
+ n === "center" ? "-translate-y-1/2" : ""
63
+ ].filter(Boolean);
64
+ }), f = l(() => ({
65
+ transform: `
66
+ ${e.position.includes("center") ? "translate(-50%, -50%)" : ""}
67
+ translate(${e.ejeX}px, ${e.ejeY}px)
68
+ `.trim()
69
+ }));
70
+ return (o, n) => (a(), i("div", m, [
71
+ u(o.$slots, "default"),
72
+ t.visible ? (a(), i("div", d({
30
73
  key: 0,
31
- class: a.value
32
- }, l.$attrs), [
33
- e.dot ? n("", !0) : (r(), o("span", p, u(e.text), 1))
34
- ], 16)) : n("", !0)
74
+ class: [...c.value, t.bgColor, t.textColor, t.textSize, t.fontWeight, t.rounded, "px-2 py-1 min-w-[20px] min-h-[20px] flex items-center justify-center"],
75
+ style: f.value
76
+ }, o.$attrs), [
77
+ t.dot ? s("", !0) : (a(), i("span", g, p(t.text), 1))
78
+ ], 16)) : s("", !0)
35
79
  ]));
36
80
  }
37
81
  });
38
82
  export {
39
- m as default
83
+ y as default
40
84
  };
@@ -1,4 +1,4 @@
1
- import { mergeModels as j, toRefs as ce, useModel as de, ref as pe, watch as N, computed as z, createElementBlock as c, openBlock as l, mergeProps as P, createCommentVNode as d, createElementVNode as D, renderSlot as a, createBlock as w, unref as s, normalizeClass as K, withDirectives as ue, vModelText as me, normalizeProps as p, guardReactiveProps as g, Fragment as fe, createVNode as A, createSlots as L, renderList as U, withCtx as H, isRef as ge } from "vue";
1
+ import { mergeModels as j, toRefs as ce, useModel as de, ref as pe, watch as N, computed as z, createElementBlock as c, openBlock as l, mergeProps as P, createCommentVNode as d, createElementVNode as D, renderSlot as a, createBlock as w, unref as s, normalizeClass as K, withDirectives as ue, vModelText as me, normalizeProps as p, guardReactiveProps as g, Fragment as fe, createVNode as A, createSlots as L, renderList as U, withCtx as x, isRef as ge } from "vue";
2
2
  import { isMobile as b } from "../../../../utils/_platform.js";
3
3
  import he from "./KunTableHeaders.vue.js";
4
4
  import ye from "./KunTableFooter.vue.js";
@@ -25,8 +25,8 @@ const Ae = ["placeholder"], Me = { class: "flex-1 overflow-auto" }, Ee = { key:
25
25
  selectedItemsModifiers: {}
26
26
  }),
27
27
  emits: /* @__PURE__ */ j(["update:page", "update:itemsPerPage", "update:sortBy", "update:search"], ["update:selectedItems"]),
28
- setup(M, { emit: x }) {
29
- const E = x, u = M, v = ce(u), O = de(M, "selectedItems"), {
28
+ setup(M, { emit: H }) {
29
+ const E = H, u = M, v = ce(u), O = de(M, "selectedItems"), {
30
30
  headers: R,
31
31
  showExpand: S,
32
32
  showSelect: C,
@@ -149,7 +149,7 @@ const Ae = ["placeholder"], Me = { class: "flex-1 overflow-auto" }, Ee = { key:
149
149
  }, L({ _: 2 }, [
150
150
  U(e.$slots, (o, i) => ({
151
151
  name: i,
152
- fn: H((n) => [
152
+ fn: x((n) => [
153
153
  a(e.$slots, i, p(g(n)))
154
154
  ])
155
155
  }))
@@ -173,7 +173,7 @@ const Ae = ["placeholder"], Me = { class: "flex-1 overflow-auto" }, Ee = { key:
173
173
  }, L({ _: 2 }, [
174
174
  U(e.$slots, (o, i) => ({
175
175
  name: i,
176
- fn: H((n) => [
176
+ fn: x((n) => [
177
177
  a(e.$slots, i, p(g(n)))
178
178
  ])
179
179
  }))
@@ -184,7 +184,7 @@ const Ae = ["placeholder"], Me = { class: "flex-1 overflow-auto" }, Ee = { key:
184
184
  ]),
185
185
  s(m).length ? d("", !0) : (l(), c("div", Be, [
186
186
  A(Ce, {
187
- class: "h-full flex justify-center items-center",
187
+ class: "h-full flex justify-center items-center text-center",
188
188
  title: e.noDataText,
189
189
  titleSize: "text-4xl"
190
190
  }, null, 8, ["title"])
@@ -1,9 +1,9 @@
1
- import { computed as c, createElementBlock as o, openBlock as i, normalizeClass as x, createElementVNode as l, createCommentVNode as r, renderSlot as m, withModifiers as g, Fragment as h, renderList as S, toDisplayString as f, unref as u, createTextVNode as B } from "vue";
2
- import { getValue as C, formatValue as E } from "../../../../utils/tableFormatters.js";
3
- const $ = { class: "flex items-center justify-between gap-2 mb-2 print:hidden" }, j = { key: 0 }, V = { key: 0 }, A = { key: 1 }, N = { key: 1 }, T = ["checked"], F = { class: "flex flex-col gap-2" }, O = { class: "font-semibold text-slate-600 dark:text-slate-300" }, R = {
1
+ import { computed as m, createElementBlock as o, openBlock as i, normalizeClass as f, createElementVNode as l, createCommentVNode as r, renderSlot as u, withModifiers as v, Fragment as h, renderList as B, toDisplayString as C, createBlock as $, resolveDynamicComponent as E, unref as d, createTextVNode as j } from "vue";
2
+ import { getValue as x, formatValue as V } from "../../../../utils/tableFormatters.js";
3
+ const A = { class: "flex items-center justify-between gap-2 mb-2 print:hidden" }, N = { key: 0 }, T = { key: 0 }, D = { key: 1 }, F = { key: 1 }, O = ["checked"], R = { class: "flex flex-col gap-2" }, z = { class: "font-semibold text-slate-600 dark:text-slate-300" }, I = {
4
4
  key: 0,
5
5
  class: "flex justify-between items-start mt-4 text-sm"
6
- }, z = { class: "text-right" }, D = "p-4 shadow-sm", I = "bg-slate-100 dark:bg-slate-900", M = {
6
+ }, K = { class: "text-right" }, L = "p-4 shadow-sm", M = "bg-slate-100 dark:bg-slate-900", H = {
7
7
  __name: "KunTableIterator",
8
8
  props: {
9
9
  item: Object,
@@ -22,73 +22,83 @@ const $ = { class: "flex items-center justify-between gap-2 mb-2 print:hidden" }
22
22
  customSlots: Object
23
23
  },
24
24
  emits: ["toggle-expand", "toggle-select", "row-click"],
25
- setup(e, { emit: b }) {
26
- const s = e, d = b;
27
- function k(a, n) {
28
- const t = typeof s.rowClassCondition == "function" ? s.rowClassCondition({ item: a, index: n }) : s.rowClassCondition;
25
+ setup(e, { emit: k }) {
26
+ const n = e, c = k;
27
+ function b(a, s) {
28
+ const t = typeof n.rowClassCondition == "function" ? n.rowClassCondition({ item: a, index: s }) : n.rowClassCondition;
29
29
  return (t == null ? void 0 : t.trim()) || "";
30
30
  }
31
- const v = c(() => s.rowClass || I), w = c(() => k(s.item, s.index)), y = c(() => [
32
- D,
33
- w.value || v.value,
34
- s.isSelected ? s.selectedClass : "",
35
- s.border,
36
- s.rounded
31
+ const w = m(() => n.rowClass || M), y = m(() => b(n.item, n.index)), S = m(() => [
32
+ L,
33
+ y.value || w.value,
34
+ n.isSelected ? n.selectedClass : "",
35
+ n.border,
36
+ n.rounded
37
37
  ]);
38
- return (a, n) => (i(), o("div", {
39
- onClick: n[2] || (n[2] = (t) => d("row-click", { item: e.item, index: e.index, event: t })),
40
- class: x(y.value)
38
+ return (a, s) => (i(), o("div", {
39
+ onClick: s[2] || (s[2] = (t) => c("row-click", { item: e.item, index: e.index, event: t })),
40
+ class: f(S.value)
41
41
  }, [
42
- l("div", $, [
43
- e.showExpand ? (i(), o("div", j, [
44
- m(a.$slots, "expand-icon", {
42
+ l("div", A, [
43
+ e.showExpand ? (i(), o("div", N, [
44
+ u(a.$slots, "expand-icon", {
45
45
  item: e.item,
46
46
  index: e.index
47
47
  }, () => [
48
48
  l("button", {
49
49
  class: "text-xl font-bold focus:outline-none",
50
- onClick: n[0] || (n[0] = g((t) => d("toggle-expand", e.item), ["stop"]))
50
+ onClick: s[0] || (s[0] = v((t) => c("toggle-expand", e.item), ["stop"]))
51
51
  }, [
52
- e.isExpanded ? (i(), o("span", V, "−")) : (i(), o("span", A, "+"))
52
+ e.isExpanded ? (i(), o("span", T, "−")) : (i(), o("span", D, "+"))
53
53
  ])
54
54
  ])
55
55
  ])) : r("", !0),
56
- e.showSelect ? (i(), o("div", N, [
56
+ e.showSelect ? (i(), o("div", F, [
57
57
  l("input", {
58
58
  type: "checkbox",
59
59
  checked: e.isSelected,
60
- onChange: n[1] || (n[1] = g((t) => d("toggle-select", e.item), ["stop"])),
60
+ onChange: s[1] || (s[1] = v((t) => c("toggle-select", e.item), ["stop"])),
61
61
  class: "form-checkbox w-5 h-5"
62
- }, null, 40, T)
62
+ }, null, 40, O)
63
63
  ])) : r("", !0)
64
64
  ]),
65
- l("div", F, [
66
- (i(!0), o(h, null, S(e.headers, (t) => (i(), o("div", {
67
- key: t.value,
68
- class: "flex justify-between text-sm"
69
- }, [
70
- l("div", O, f(t.label ?? t.text), 1),
71
- l("div", {
72
- class: x(["text-right text-slate-800 dark:text-slate-100", {
73
- "text-right": t.align === "right",
74
- "text-center": t.align === "center",
75
- "text-left": t.align === "left" || !t.align
76
- }])
65
+ l("div", R, [
66
+ (i(!0), o(h, null, B(e.headers, (t) => {
67
+ var g;
68
+ return i(), o("div", {
69
+ key: t.value,
70
+ class: "flex justify-between text-sm"
77
71
  }, [
78
- m(a.$slots, `item.${t.value}`, {
79
- item: e.item,
80
- value: u(C)(t, e.item),
81
- index: e.index
82
- }, () => [
83
- B(f(u(E)(t, u(C)(t, e.item))), 1)
84
- ])
85
- ], 2)
86
- ]))), 128))
72
+ l("div", z, C(t.label ?? t.text), 1),
73
+ l("div", {
74
+ class: f(["text-right text-slate-800 dark:text-slate-100", {
75
+ "text-right": t.align === "right",
76
+ "text-center": t.align === "center",
77
+ "text-left": t.align === "left" || !t.align
78
+ }])
79
+ }, [
80
+ (g = e.customSlots) != null && g[`item.${t.value}`] ? (i(), $(E(e.customSlots[`item.${t.value}`]), {
81
+ key: 0,
82
+ item: e.item,
83
+ value: d(x)(t, e.item),
84
+ index: e.index,
85
+ header: t
86
+ }, null, 8, ["item", "value", "index", "header"])) : u(a.$slots, `item.${t.value}`, {
87
+ key: 1,
88
+ item: e.item,
89
+ value: d(x)(t, e.item),
90
+ index: e.index
91
+ }, () => [
92
+ j(C(d(V)(t, d(x)(t, e.item))), 1)
93
+ ])
94
+ ], 2)
95
+ ]);
96
+ }), 128))
87
97
  ]),
88
- e.hasActions ? (i(), o("div", R, [
89
- n[3] || (n[3] = l("div", { class: "font-semibold text-slate-600 dark:text-slate-300" }, " Acciones ", -1)),
90
- l("div", z, [
91
- m(a.$slots, "item.actions", {
98
+ e.hasActions ? (i(), o("div", I, [
99
+ s[3] || (s[3] = l("div", { class: "font-semibold text-slate-600 dark:text-slate-300" }, " Acciones ", -1)),
100
+ l("div", K, [
101
+ u(a.$slots, "item.actions", {
92
102
  item: e.item,
93
103
  index: e.index,
94
104
  loading: e.loading
@@ -99,5 +109,5 @@ const $ = { class: "flex items-center justify-between gap-2 mb-2 print:hidden" }
99
109
  }
100
110
  };
101
111
  export {
102
- M as default
112
+ H as default
103
113
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.308",
3
+ "version": "0.1.310",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",