adverich-kun-ui 0.1.241 → 0.1.243

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.
@@ -54,8 +54,8 @@ const b = ["innerHTML"], S = {
54
54
  class: c([o.color, s.value, o.contentClass])
55
55
  }, null, 8, ["class"])) : (a(), i("span", {
56
56
  key: 2,
57
- innerHTML: r.value ? n.value : "",
58
- class: c([r.value ? "" : n.value, o.color, s.value, o.contentClass])
57
+ class: c([r.value ? "" : n.value, o.color, s.value, o.contentClass]),
58
+ innerHTML: r.value ? n.value : ""
59
59
  }, null, 10, b))
60
60
  ], 16));
61
61
  }
@@ -5,8 +5,8 @@ import fe from "./KunTableFooter.vue.js";
5
5
  import ye from "./KunTableRows.vue.js";
6
6
  import be from "./KunTableIterators.vue.js";
7
7
  import we from "../../../KunBtn/src/components/KunBtn.vue.js";
8
- import ve from "./KunTableFilter.vue.js";
9
- import Se from "../../../KunCard/src/components/KunCard.vue.js";
8
+ import Se from "./KunTableFilter.vue.js";
9
+ import ve from "../../../KunCard/src/components/KunCard.vue.js";
10
10
  import Ce from "../composables/useExpand.js";
11
11
  import $e from "../composables/useOptions.js";
12
12
  import ke from "../composables/useSelect.js";
@@ -23,28 +23,28 @@ const Fe = ["placeholder"], Ae = { key: 0 }, Ee = { key: 5 }, Be = { class: "h-f
23
23
  }),
24
24
  emits: /* @__PURE__ */ V(["update:page", "update:itemsPerPage", "update:sortBy", "update:search"], ["update:selectedItems"]),
25
25
  setup(E, { emit: O }) {
26
- const B = O, r = E, v = ie(r), W = de(E, "selectedItems"), {
26
+ const B = O, r = E, S = ie(r), W = de(E, "selectedItems"), {
27
27
  headers: b,
28
- showExpand: S,
28
+ showExpand: v,
29
29
  showSelect: C,
30
30
  rowClass: I,
31
- hideDefaultFooter: x,
32
- hideDefaultHeader: H,
33
- tableClass: Q,
34
- wrapperClass: q,
31
+ hideDefaultFooter: H,
32
+ hideDefaultHeader: Q,
33
+ tableClass: q,
34
+ wrapperClass: x,
35
35
  pageOptions: G,
36
36
  items: J,
37
37
  searchable: M,
38
38
  debounceTime: X
39
- } = v, h = pe(r.search);
39
+ } = S, h = pe(r.search);
40
40
  j(() => r.search, (e) => {
41
41
  e !== h.value && (h.value = e);
42
42
  });
43
- const { filteredItems: Y, setSearch: Z, modalFilter: g, applyColumnFilters: _, clearFilters: ee, appliedFilters: se } = Pe(v, X);
43
+ const { filteredItems: Y, setSearch: Z, modalFilter: g, applyColumnFilters: _, clearFilters: ee, appliedFilters: se } = Pe(S, X);
44
44
  j(h, (e) => {
45
45
  B("update:search", e), Z(e);
46
46
  });
47
- const { options: n, paginatedItems: p, updateSort: te } = $e(v, B, Y), { isSelected: $, toggleSelect: k, toggleSelectAll: le, allSelected: oe, someSelected: ae } = ke(p, W), { isExpanded: P, toggleExpand: T } = Ce(), m = z(() => ({
47
+ const { options: n, paginatedItems: p, updateSort: te } = $e(S, B, Y), { isSelected: $, toggleSelect: k, toggleSelectAll: le, allSelected: oe, someSelected: ae } = ke(p, W), { isExpanded: P, toggleExpand: T } = Ce(), m = z(() => ({
48
48
  items: p.value,
49
49
  headers: b.value,
50
50
  page: n.page,
@@ -55,7 +55,7 @@ const Fe = ["placeholder"], Ae = { key: 0 }, Ee = { key: 5 }, Be = { class: "h-f
55
55
  isExpanded: P,
56
56
  sortBy: n.sortBy,
57
57
  hasActions: r.hasActions
58
- })), re = [Me, q.value], ne = [Ve, Q.value];
58
+ })), re = [Me, x.value], ne = [Ve, q.value];
59
59
  return z(() => {
60
60
  var t;
61
61
  let e = ((t = r.headers) == null ? void 0 : t.length) || 0;
@@ -93,12 +93,12 @@ const Fe = ["placeholder"], Ae = { key: 0 }, Ee = { key: 5 }, Be = { class: "h-f
93
93
  e.$slots.colgroup && !s(w) ? (l(), c("colgroup", Ae, [
94
94
  a(e.$slots, "colgroup", d(u(m.value)))
95
95
  ])) : i("", !0),
96
- !s(H) && !s(w) ? (l(), y(ge, {
96
+ !s(Q) && !s(w) ? (l(), y(ge, {
97
97
  key: 1,
98
98
  headers: s(b),
99
99
  "sort-by": s(n).sortBy,
100
100
  "show-select": s(C),
101
- "show-expand": s(S),
101
+ "show-expand": s(v),
102
102
  "all-selected": s(oe),
103
103
  "some-selected": s(ae),
104
104
  "thead-class": e.theadClass,
@@ -123,11 +123,12 @@ const Fe = ["placeholder"], Ae = { key: 0 }, Ee = { key: 5 }, Be = { class: "h-f
123
123
  "is-selected": s($),
124
124
  "is-expanded": s(P),
125
125
  "show-select": s(C),
126
- "show-expand": s(S),
126
+ "show-expand": s(v),
127
127
  "has-actions": e.hasActions,
128
128
  "action-loading-map": e.actionLoadingMap,
129
129
  onToggleExpand: s(T),
130
- onToggleSelect: s(k)
130
+ onToggleSelect: s(k),
131
+ customSlots: e.customSlots
131
132
  }, U({ _: 2 }, [
132
133
  N(e.$slots, (o, f) => ({
133
134
  name: f,
@@ -135,7 +136,7 @@ const Fe = ["placeholder"], Ae = { key: 0 }, Ee = { key: 5 }, Be = { class: "h-f
135
136
  a(e.$slots, f, d(u(F)))
136
137
  ])
137
138
  }))
138
- ]), 1032, ["items", "headers", "tbody-class", "row-class", "tr-class", "td-class", "selected-class", "striped-class", "is-selected", "is-expanded", "show-select", "show-expand", "has-actions", "action-loading-map", "onToggleExpand", "onToggleSelect"]),
139
+ ]), 1032, ["items", "headers", "tbody-class", "row-class", "tr-class", "td-class", "selected-class", "striped-class", "is-selected", "is-expanded", "show-select", "show-expand", "has-actions", "action-loading-map", "onToggleExpand", "onToggleSelect", "customSlots"]),
139
140
  a(e.$slots, "body.append", d(u(m.value)))
140
141
  ], 64)) : s(p).length && s(w) ? (l(), y(be, {
141
142
  key: 4,
@@ -145,7 +146,7 @@ const Fe = ["placeholder"], Ae = { key: 0 }, Ee = { key: 5 }, Be = { class: "h-f
145
146
  "is-selected": s($),
146
147
  "is-expanded": s(P),
147
148
  "show-select": s(C),
148
- "show-expand": s(S),
149
+ "show-expand": s(v),
149
150
  "has-actions": e.hasActions,
150
151
  "action-loading-map": e.actionLoadingMap,
151
152
  onToggleExpand: s(T),
@@ -163,14 +164,14 @@ const Fe = ["placeholder"], Ae = { key: 0 }, Ee = { key: 5 }, Be = { class: "h-f
163
164
  ])) : i("", !0)
164
165
  ]),
165
166
  D("div", Be, [
166
- s(p).length ? i("", !0) : (l(), y(Se, {
167
+ s(p).length ? i("", !0) : (l(), y(ve, {
167
168
  key: 0,
168
169
  class: "h-full flex justify-center items-center",
169
170
  title: e.noDataText,
170
171
  titleSize: "text-4xl"
171
172
  }, null, 8, ["title"]))
172
173
  ]),
173
- s(x) ? a(e.$slots, "footer", d(A({ key: 2 }, m.value))) : (l(), c("div", Ie, [
174
+ s(H) ? a(e.$slots, "footer", d(A({ key: 2 }, m.value))) : (l(), c("div", Ie, [
174
175
  R(fe, {
175
176
  "items-length": s(J).length,
176
177
  "items-per-page": s(n).itemsPerPage,
@@ -180,7 +181,7 @@ const Fe = ["placeholder"], Ae = { key: 0 }, Ee = { key: 5 }, Be = { class: "h-f
180
181
  "onUpdate:page": t[3] || (t[3] = (o) => s(n).page = o)
181
182
  }, null, 8, ["items-length", "items-per-page", "current-page", "page-options"])
182
183
  ])),
183
- e.filterable && s(g) ? (l(), y(ve, {
184
+ e.filterable && s(g) ? (l(), y(Se, {
184
185
  key: 3,
185
186
  filters: e.filters,
186
187
  modelValue: s(g),
@@ -1,6 +1,6 @@
1
- import { createElementBlock as s, openBlock as n, normalizeClass as a, createCommentVNode as c, renderSlot as m, createElementVNode as b, withModifiers as w, Fragment as f, renderList as h, unref as g, createTextVNode as y, toDisplayString as S } from "vue";
2
- import { getValue as x, formatValue as v } from "../../../../utils/tableFormatters.js";
3
- const B = { key: 0 }, $ = { key: 1 }, A = ["checked"], E = "hover:bg-slate-300 dark:hover:bg-slate-600 border-t border-slate-300 dark:border-slate-700", T = "bg-slate-100 dark:bg-slate-900", V = "px-3 py-2 whitespace-nowrap text-sm text-black dark:text-white", R = {
1
+ import { createElementBlock as l, openBlock as s, normalizeClass as a, createCommentVNode as r, renderSlot as u, createElementVNode as w, withModifiers as y, Fragment as S, renderList as f, createBlock as v, resolveDynamicComponent as h, unref as c, createTextVNode as B, toDisplayString as $ } from "vue";
2
+ import { getValue as g, formatValue as A } from "../../../../utils/tableFormatters.js";
3
+ const E = { key: 0 }, T = { key: 1 }, V = ["checked"], N = "hover:bg-slate-300 dark:hover:bg-slate-600 border-t border-slate-300 dark:border-slate-700", j = "bg-slate-100 dark:bg-slate-900", D = "px-3 py-2 whitespace-nowrap text-sm text-black dark:text-white", z = {
4
4
  __name: "KunTableRow",
5
5
  props: {
6
6
  item: Object,
@@ -17,73 +17,85 @@ const B = { key: 0 }, $ = { key: 1 }, A = ["checked"], E = "hover:bg-slate-300 d
17
17
  isSelected: Boolean,
18
18
  hasActions: Boolean,
19
19
  actionsAlign: String,
20
- loading: Boolean
20
+ loading: Boolean,
21
+ customSlots: Object
21
22
  },
22
23
  emits: ["toggle-expand", "toggle-select", "row-click"],
23
- setup(e, { emit: u }) {
24
- const l = e, r = u, k = [
25
- E,
26
- T,
27
- l.rowClass,
28
- l.trClass,
29
- l.stripedClass,
30
- l.isSelected ? l.selectedClass : ""
31
- ], o = [V, l.tdClass], C = ["text-center", l.actionsAlign];
32
- return (d, i) => (n(), s("tr", {
33
- class: a(k),
34
- onClick: i[2] || (i[2] = (t) => r("row-click", { item: e.item, index: e.index, event: t }))
24
+ setup(e, { emit: k }) {
25
+ const n = e, m = k, C = [
26
+ N,
27
+ j,
28
+ n.rowClass,
29
+ n.trClass,
30
+ n.stripedClass,
31
+ n.isSelected ? n.selectedClass : ""
32
+ ], o = [D, n.tdClass], b = ["text-center", n.actionsAlign];
33
+ return (d, i) => (s(), l("tr", {
34
+ class: a(C),
35
+ onClick: i[2] || (i[2] = (t) => m("row-click", { item: e.item, index: e.index, event: t }))
35
36
  }, [
36
- e.showExpand ? (n(), s("td", {
37
+ e.showExpand ? (s(), l("td", {
37
38
  key: 0,
38
39
  class: a(o)
39
40
  }, [
40
- d.$slots.expandIcon ? m(d.$slots, "expand-icon", {
41
+ d.$slots.expandIcon ? u(d.$slots, "expand-icon", {
41
42
  key: 0,
42
43
  item: e.item,
43
44
  index: e.index
44
- }) : (n(), s("button", {
45
+ }) : (s(), l("button", {
45
46
  key: 1,
46
- onClick: i[0] || (i[0] = (t) => r("toggle-expand", e.item))
47
+ onClick: i[0] || (i[0] = (t) => m("toggle-expand", e.item))
47
48
  }, [
48
- e.isExpanded ? (n(), s("span", B, "−")) : (n(), s("span", $, "+"))
49
+ e.isExpanded ? (s(), l("span", E, "−")) : (s(), l("span", T, "+"))
49
50
  ]))
50
- ])) : c("", !0),
51
- e.showSelect ? (n(), s("td", {
51
+ ])) : r("", !0),
52
+ e.showSelect ? (s(), l("td", {
52
53
  key: 1,
53
54
  class: a([o, "h-full w-10 flex flex-col items-center justify-center"])
54
55
  }, [
55
- b("input", {
56
+ w("input", {
56
57
  type: "checkbox",
57
58
  checked: e.isSelected,
58
- onChange: i[1] || (i[1] = w((t) => r("toggle-select", e.item), ["stop"])),
59
+ onChange: i[1] || (i[1] = y((t) => m("toggle-select", e.item), ["stop"])),
59
60
  class: "h-5 w-5 text-blue-600 transition-all duration-200 ease-in-out rounded"
60
- }, null, 40, A)
61
- ])) : c("", !0),
62
- (n(!0), s(f, null, h(e.headers, (t) => (n(), s("td", {
63
- key: t.value,
64
- class: a([o, t.align === "right" ? "text-right" : t.align === "left" ? "text-left" : "text-center"])
65
- }, [
66
- m(d.$slots, `item.${t.value}`, {
67
- item: e.item,
68
- value: g(x)(t, e.item),
69
- index: e.index
70
- }, () => [
71
- y(S(g(v)(t, g(x)(t, e.item))), 1)
72
- ])
73
- ], 2))), 128)),
74
- e.hasActions ? (n(), s("td", {
61
+ }, null, 40, V)
62
+ ])) : r("", !0),
63
+ (s(!0), l(S, null, f(e.headers, (t) => {
64
+ var x;
65
+ return s(), l("td", {
66
+ key: t.value,
67
+ class: a([o, t.align === "right" ? "text-right" : t.align === "left" ? "text-left" : "text-center"])
68
+ }, [
69
+ (x = e.customSlots) != null && x[`item.${t.value}`] ? (s(), v(h(e.customSlots[`item.${t.value}`]), {
70
+ key: 0,
71
+ item: e.item,
72
+ value: c(g)(t, e.item),
73
+ index: e.index,
74
+ header: t
75
+ }, null, 8, ["item", "value", "index", "header"])) : u(d.$slots, `item.${t.value}`, {
76
+ key: 1,
77
+ item: e.item,
78
+ value: c(g)(t, e.item),
79
+ index: e.index,
80
+ header: t
81
+ }, () => [
82
+ B($(c(A)(t, c(g)(t, e.item))), 1)
83
+ ])
84
+ ], 2);
85
+ }), 128)),
86
+ e.hasActions ? (s(), l("td", {
75
87
  key: 2,
76
- class: a([o, C])
88
+ class: a([o, b])
77
89
  }, [
78
- m(d.$slots, "item.actions", {
90
+ u(d.$slots, "item.actions", {
79
91
  item: e.item,
80
92
  index: e.index,
81
93
  loading: e.loading
82
94
  })
83
- ], 2)) : c("", !0)
95
+ ], 2)) : r("", !0)
84
96
  ]));
85
97
  }
86
98
  };
87
99
  export {
88
- R as default
100
+ z as default
89
101
  };
@@ -1,4 +1,4 @@
1
- import { computed as g, createElementBlock as d, openBlock as l, normalizeClass as p, Fragment as c, renderList as u, createVNode as E, createCommentVNode as S, mergeProps as h, createSlots as b, withCtx as C, renderSlot as f, createElementVNode as m } from "vue";
1
+ import { computed as w, createElementBlock as l, openBlock as d, normalizeClass as g, Fragment as c, renderList as u, createVNode as b, createCommentVNode as E, mergeProps as h, createSlots as p, withCtx as C, renderSlot as m, createElementVNode as f } from "vue";
2
2
  import B from "./KunTableRow.vue.js";
3
3
  const A = { key: 0 }, $ = ["colspan"], k = "table-auto w-full text-sm text-left", K = {
4
4
  __name: "KunTableRows",
@@ -15,58 +15,59 @@ const A = { key: 0 }, $ = ["colspan"], k = "table-auto w-full text-sm text-left"
15
15
  },
16
16
  itemKey: {
17
17
  type: Function,
18
- default: (e, s) => s
18
+ default: (e, o) => o
19
19
  },
20
20
  headers: Array,
21
21
  showExpand: Boolean,
22
22
  showSelect: Boolean,
23
23
  hasActions: Boolean,
24
24
  loading: Boolean,
25
- actionLoadingMap: Object
25
+ actionLoadingMap: Object,
26
+ customSlots: Object
26
27
  },
27
28
  setup(e) {
28
- const s = e, y = [k, s.tbodyClass], x = g(() => {
29
- var o;
30
- let t = ((o = s.headers) == null ? void 0 : o.length) || 0;
31
- return s.showSelect && (t += 1), s.showExpand && (t += 1), s.hasActions && (t += 1), t;
29
+ const o = e, y = [k, o.tbodyClass], x = w(() => {
30
+ var a;
31
+ let t = ((a = o.headers) == null ? void 0 : a.length) || 0;
32
+ return o.showSelect && (t += 1), o.showExpand && (t += 1), o.hasActions && (t += 1), t;
32
33
  });
33
- return (t, o) => (l(), d("tbody", {
34
- class: p(y)
34
+ return (t, a) => (d(), l("tbody", {
35
+ class: g(y)
35
36
  }, [
36
- (l(!0), d(c, null, u(e.items, (a, n) => (l(), d(c, {
37
- key: e.itemKey(a, n)
37
+ (d(!0), l(c, null, u(e.items, (s, n) => (d(), l(c, {
38
+ key: e.itemKey(s, n)
38
39
  }, [
39
- E(B, h({
40
- item: a,
40
+ b(B, h({
41
+ item: s,
41
42
  index: n,
42
43
  headers: e.headers,
43
44
  showExpand: e.showExpand,
44
45
  showSelect: e.showSelect,
45
- "is-selected": e.isSelected(a),
46
- "is-expanded": e.isExpanded(a),
46
+ "is-selected": e.isSelected(s),
47
+ "is-expanded": e.isExpanded(s),
47
48
  "has-actions": e.hasActions,
48
- loading: e.actionLoadingMap[a.id] || !1
49
- }, { ref_for: !0 }, t.$attrs), b({ _: 2 }, [
49
+ loading: e.actionLoadingMap[s.id] || !1
50
+ }, { ref_for: !0 }, t.$attrs, { customSlots: e.customSlots }), p({ _: 2 }, [
50
51
  u(t.$slots, (F, i) => ({
51
52
  name: i,
52
- fn: C((w) => {
53
+ fn: C((S) => {
53
54
  var r;
54
55
  return [
55
- f(t.$slots, i, h({ ref_for: !0 }, { ...w, item: a, index: n, loading: ((r = e.actionLoadingMap) == null ? void 0 : r[a.id]) || !1 }))
56
+ m(t.$slots, i, h({ ref_for: !0 }, { ...S, item: s, index: n, loading: ((r = e.actionLoadingMap) == null ? void 0 : r[s.id]) || !1 }))
56
57
  ];
57
58
  })
58
59
  }))
59
- ]), 1040, ["item", "index", "headers", "showExpand", "showSelect", "is-selected", "is-expanded", "has-actions", "loading"]),
60
- e.isExpanded(a) ? (l(), d("tr", A, [
61
- m("td", { colspan: x.value }, [
62
- f(t.$slots, "expand", {
63
- item: a,
60
+ ]), 1040, ["item", "index", "headers", "showExpand", "showSelect", "is-selected", "is-expanded", "has-actions", "loading", "customSlots"]),
61
+ e.isExpanded(s) ? (d(), l("tr", A, [
62
+ f("td", { colspan: x.value }, [
63
+ m(t.$slots, "expand", {
64
+ item: s,
64
65
  index: n
65
66
  }, () => [
66
- o[0] || (o[0] = m("div", { class: "text-center opacity-70 text-sm" }, "No hay contenido expandido.", -1))
67
+ a[0] || (a[0] = f("div", { class: "text-center opacity-70 text-sm" }, "No hay contenido expandido.", -1))
67
68
  ])
68
69
  ], 8, $)
69
- ])) : S("", !0)
70
+ ])) : E("", !0)
70
71
  ], 64))), 128))
71
72
  ]));
72
73
  }
@@ -54,6 +54,7 @@ const t = () => ({
54
54
  noDataText: { type: String, default: "No hay elementos disponibles" },
55
55
  loadingText: { type: String, default: "Cargando..." },
56
56
  // Slots control
57
+ customSlots: Object,
57
58
  showTopSlot: { type: Boolean, default: !1 },
58
59
  showBottomSlot: { type: Boolean, default: !1 }
59
60
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.241",
3
+ "version": "0.1.243",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",