adverich-kun-ui 0.1.238 → 0.1.239

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,29 +1,29 @@
1
- import { mergeModels as V, toRefs as ie, useModel as de, ref as pe, watch as j, computed as z, createElementBlock as c, openBlock as l, mergeProps as A, createCommentVNode as i, createElementVNode as D, renderSlot as a, createBlock as y, unref as s, normalizeClass as L, withDirectives as ce, vModelText as me, normalizeProps as d, guardReactiveProps as u, Fragment as ue, createVNode as R, createSlots as U, renderList as N, withCtx as K, isRef as he } from "vue";
1
+ import { mergeModels as V, toRefs as ne, useModel as ie, ref as de, watch as j, computed as z, createElementBlock as c, openBlock as l, mergeProps as A, createCommentVNode as i, createElementVNode as D, renderSlot as a, createBlock as y, unref as s, normalizeClass as L, withDirectives as pe, vModelText as ce, normalizeProps as d, guardReactiveProps as u, Fragment as me, createVNode as R, createSlots as U, renderList as N, withCtx as K, isRef as ue } from "vue";
2
2
  import { isMobile as w } from "../../../../utils/_platform.js";
3
- import ge from "./KunTableHeaders.vue.js";
4
- import fe from "./KunTableFooter.vue.js";
5
- import ye from "./KunTableRows.vue.js";
6
- import be from "./KunTableIterators.vue.js";
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";
10
- import Ce from "../composables/useExpand.js";
11
- import $e from "../composables/useOptions.js";
12
- import ke from "../composables/useSelect.js";
13
- import Pe from "../composables/useFilter.js";
14
- import Te from "../composables/KunTableProps.js";
15
- const Fe = ["placeholder"], Ae = { key: 0 }, Ee = { key: 5 }, Be = { class: "h-full" }, Ie = {
3
+ import he from "./KunTableHeaders.vue.js";
4
+ import ge from "./KunTableFooter.vue.js";
5
+ import fe from "./KunTableRows.vue.js";
6
+ import ye from "./KunTableIterators.vue.js";
7
+ import be from "../../../KunBtn/src/components/KunBtn.vue.js";
8
+ import we from "./KunTableFilter.vue.js";
9
+ import ve from "../../../KunCard/src/components/KunCard.vue.js";
10
+ import Se from "../composables/useExpand.js";
11
+ import Ce from "../composables/useOptions.js";
12
+ import $e from "../composables/useSelect.js";
13
+ import ke from "../composables/useFilter.js";
14
+ import Pe from "../composables/KunTableProps.js";
15
+ const Te = ["placeholder"], Fe = { key: 0 }, Ae = { key: 5 }, Ee = { class: "h-full" }, Be = {
16
16
  key: 1,
17
17
  class: "sticky bottom-0 z-10"
18
- }, Me = "overflow-auto h-full w-full flex flex-col border border-slate-200 dark:border-slate-800 rounded", Ve = "table-auto w-full h-fit text-sm text-left", Ge = {
18
+ }, Ie = "overflow-auto h-full w-full flex flex-col border border-slate-200 dark:border-slate-800 rounded", Me = "table-auto w-full h-fit text-sm text-left", Ge = {
19
19
  __name: "KunTable",
20
- props: /* @__PURE__ */ V(Te(), {
20
+ props: /* @__PURE__ */ V(Pe(), {
21
21
  selectedItems: { type: Array, default: () => [] },
22
22
  selectedItemsModifiers: {}
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, v = ne(r), W = ie(E, "selectedItems"), {
27
27
  headers: b,
28
28
  showExpand: S,
29
29
  showSelect: C,
@@ -35,16 +35,16 @@ const Fe = ["placeholder"], Ae = { key: 0 }, Ee = { key: 5 }, Be = { class: "h-f
35
35
  pageOptions: G,
36
36
  items: J,
37
37
  searchable: M,
38
- debounceTime: X
39
- } = v, h = pe(r.search);
38
+ debounceTime: Ve
39
+ } = v, h = de(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: X, setSearch: Y, modalFilter: g, applyColumnFilters: Z, clearFilters: _, appliedFilters: ee } = ke(v);
44
44
  j(h, (e) => {
45
- B("update:search", e), Z(e);
45
+ B("update:search", e), Y(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: se } = Ce(v, B, X), { isSelected: $, toggleSelect: k, toggleSelectAll: te, allSelected: le, someSelected: oe } = $e(p, W), { isExpanded: P, toggleExpand: T } = Se(), m = z(() => ({
48
48
  items: p.value,
49
49
  headers: b.value,
50
50
  page: n.page,
@@ -55,12 +55,12 @@ 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
+ })), ae = [Ie, q.value], re = [Me, Q.value];
59
59
  return z(() => {
60
60
  var t;
61
61
  let e = ((t = r.headers) == null ? void 0 : t.length) || 0;
62
62
  return r.showSelect && (e += 1), r.showExpand && (e += 1), r.hasActions && (e += 1), e;
63
- }), (e, t) => (l(), c("div", A({ class: re }, e.$attrs, { style: { "user-select": "text" } }), [
63
+ }), (e, t) => (l(), c("div", A({ class: ae }, e.$attrs, { style: { "user-select": "text" } }), [
64
64
  s(M) || e.filterable || e.$slots.prependSearch || e.$slots.appendSearch ? (l(), c("div", {
65
65
  key: 0,
66
66
  class: L(["p-2 bg-slate-200 dark:bg-slate-800", {
@@ -70,48 +70,48 @@ const Fe = ["placeholder"], Ae = { key: 0 }, Ee = { key: 5 }, Be = { class: "h-f
70
70
  }])
71
71
  }, [
72
72
  a(e.$slots, "prependSearch"),
73
- e.filterable ? (l(), y(we, {
73
+ e.filterable ? (l(), y(be, {
74
74
  key: 0,
75
75
  onClick: t[0] || (t[0] = (o) => g.value = !0),
76
76
  text: "Filtrar",
77
77
  bgColor: "bg-slate-300 dark:bg-slate-700"
78
78
  })) : i("", !0),
79
- s(M) ? ce((l(), c("input", {
79
+ s(M) ? pe((l(), c("input", {
80
80
  key: 1,
81
81
  "onUpdate:modelValue": t[1] || (t[1] = (o) => h.value = o),
82
82
  type: "text",
83
83
  placeholder: e.searchPlaceholder,
84
84
  class: "border mx-2 px-3 py-1 rounded w-full max-w-sm text-sm"
85
- }, null, 8, Fe)), [
86
- [me, h.value]
85
+ }, null, 8, Te)), [
86
+ [ce, h.value]
87
87
  ]) : i("", !0),
88
88
  a(e.$slots, "appendSearch")
89
89
  ], 2)) : i("", !0),
90
90
  D("table", {
91
- class: L(ne)
91
+ class: L(re)
92
92
  }, [
93
- e.$slots.colgroup && !s(w) ? (l(), c("colgroup", Ae, [
93
+ e.$slots.colgroup && !s(w) ? (l(), c("colgroup", Fe, [
94
94
  a(e.$slots, "colgroup", d(u(m.value)))
95
95
  ])) : i("", !0),
96
- !s(H) && !s(w) ? (l(), y(ge, {
96
+ !s(H) && !s(w) ? (l(), y(he, {
97
97
  key: 1,
98
98
  headers: s(b),
99
99
  "sort-by": s(n).sortBy,
100
100
  "show-select": s(C),
101
101
  "show-expand": s(S),
102
- "all-selected": s(oe),
103
- "some-selected": s(ae),
102
+ "all-selected": s(le),
103
+ "some-selected": s(oe),
104
104
  "thead-class": e.theadClass,
105
105
  "tr-class": e.trClass,
106
106
  "th-class": e.thClass,
107
107
  "has-actions": e.hasActions,
108
108
  "action-label": e.actionLabel,
109
- onSort: s(te),
110
- onToggleSelectAll: s(le)
109
+ onSort: s(se),
110
+ onToggleSelectAll: s(te)
111
111
  }, null, 8, ["headers", "sort-by", "show-select", "show-expand", "all-selected", "some-selected", "thead-class", "tr-class", "th-class", "has-actions", "action-label", "onSort", "onToggleSelectAll"])) : a(e.$slots, "thead", d(A({ key: 2 }, m.value))),
112
- s(p).length && !s(w) ? (l(), c(ue, { key: 3 }, [
112
+ s(p).length && !s(w) ? (l(), c(me, { key: 3 }, [
113
113
  a(e.$slots, "body.prepend", d(u(m.value))),
114
- R(ye, {
114
+ R(fe, {
115
115
  items: s(p),
116
116
  headers: s(b),
117
117
  "tbody-class": e.tbodyClass,
@@ -137,7 +137,7 @@ const Fe = ["placeholder"], Ae = { key: 0 }, Ee = { key: 5 }, Be = { class: "h-f
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
139
  a(e.$slots, "body.append", d(u(m.value)))
140
- ], 64)) : s(p).length && s(w) ? (l(), y(be, {
140
+ ], 64)) : s(p).length && s(w) ? (l(), y(ye, {
141
141
  key: 4,
142
142
  items: s(p),
143
143
  headers: s(b),
@@ -158,20 +158,20 @@ const Fe = ["placeholder"], Ae = { key: 0 }, Ee = { key: 5 }, Be = { class: "h-f
158
158
  ])
159
159
  }))
160
160
  ]), 1032, ["items", "headers", "row-class", "is-selected", "is-expanded", "show-select", "show-expand", "has-actions", "action-loading-map", "onToggleExpand", "onToggleSelect"])) : i("", !0),
161
- e.$slots.tfoot ? (l(), c("tfoot", Ee, [
161
+ e.$slots.tfoot ? (l(), c("tfoot", Ae, [
162
162
  a(e.$slots, "tfoot", d(u(m.value)))
163
163
  ])) : i("", !0)
164
164
  ]),
165
- D("div", Be, [
166
- s(p).length ? i("", !0) : (l(), y(Se, {
165
+ D("div", Ee, [
166
+ s(p).length ? i("", !0) : (l(), y(ve, {
167
167
  key: 0,
168
168
  class: "h-full flex justify-center items-center",
169
169
  title: e.noDataText,
170
170
  titleSize: "text-4xl"
171
171
  }, null, 8, ["title"]))
172
172
  ]),
173
- s(x) ? a(e.$slots, "footer", d(A({ key: 2 }, m.value))) : (l(), c("div", Ie, [
174
- R(fe, {
173
+ s(x) ? a(e.$slots, "footer", d(A({ key: 2 }, m.value))) : (l(), c("div", Be, [
174
+ R(ge, {
175
175
  "items-length": s(J).length,
176
176
  "items-per-page": s(n).itemsPerPage,
177
177
  "current-page": s(n).page,
@@ -180,14 +180,14 @@ const Fe = ["placeholder"], Ae = { key: 0 }, Ee = { key: 5 }, Be = { class: "h-f
180
180
  "onUpdate:page": t[3] || (t[3] = (o) => s(n).page = o)
181
181
  }, null, 8, ["items-length", "items-per-page", "current-page", "page-options"])
182
182
  ])),
183
- e.filterable && s(g) ? (l(), y(ve, {
183
+ e.filterable && s(g) ? (l(), y(we, {
184
184
  key: 3,
185
185
  filters: e.filters,
186
186
  modelValue: s(g),
187
- "onUpdate:modelValue": t[4] || (t[4] = (o) => he(g) ? g.value = o : null),
188
- onApplyFilters: s(_),
189
- onClearFilters: s(ee),
190
- activeFilters: s(se).byColumn
187
+ "onUpdate:modelValue": t[4] || (t[4] = (o) => ue(g) ? g.value = o : null),
188
+ onApplyFilters: s(Z),
189
+ onClearFilters: s(_),
190
+ activeFilters: s(ee).byColumn
191
191
  }, null, 8, ["filters", "modelValue", "onApplyFilters", "onClearFilters", "activeFilters"])) : i("", !0)
192
192
  ], 16));
193
193
  }
@@ -1,4 +1,4 @@
1
- import { ref as A, onMounted as v, watch as f, createElementBlock as r, openBlock as o, normalizeClass as a, createElementVNode as m, createCommentVNode as d, renderSlot as g, Fragment as E, renderList as T, normalizeStyle as $, toDisplayString as h, createBlock as D, resolveDynamicComponent as z } from "vue";
1
+ import { ref as A, onMounted as v, watch as k, createElementBlock as r, openBlock as o, normalizeClass as a, createElementVNode as m, createCommentVNode as d, renderSlot as g, Fragment as E, renderList as T, normalizeStyle as $, toDisplayString as h, createBlock as D, resolveDynamicComponent as z } from "vue";
2
2
  import I from "../../../../icons/IconArrowUp.vue.js";
3
3
  import L from "../../../../icons/IconArrowDown.vue.js";
4
4
  import O from "../../../../icons/IconArrowDownUp.vue.js";
@@ -30,7 +30,7 @@ const j = { key: 0 }, N = { key: 1 }, R = ["checked", "aria-checked"], U = ["onC
30
30
  function S(l) {
31
31
  if (!l.sortable) return;
32
32
  let s = null;
33
- Array.isArray(t.sortBy) ? s = t.sortBy.find((k) => k.key === l.value) : typeof t.sortBy == "string" && (s = t.sortBy === l.value ? { key: l.value, order: "asc" } : null);
33
+ Array.isArray(t.sortBy) ? s = t.sortBy.find((f) => f.key === l.value) : typeof t.sortBy == "string" && (s = t.sortBy === l.value ? { key: l.value, order: "asc" } : null);
34
34
  const e = (s == null ? void 0 : s.order) === "asc" ? "desc" : "asc";
35
35
  c("sort", { key: l.value, order: e });
36
36
  }
@@ -47,7 +47,7 @@ const j = { key: 0 }, N = { key: 1 }, R = ["checked", "aria-checked"], U = ["onC
47
47
  }, B = [F, t.theadClass], w = [H, t.trClass], i = [K, t.thClass], u = A(null), y = () => {
48
48
  u.value && (u.value.indeterminate = t.someSelected && !t.allSelected);
49
49
  };
50
- return v(y), f(() => t.someSelected, y), f(() => t.allSelected, y), (l, s) => (o(), r("thead", {
50
+ return v(y), k(() => t.someSelected, y), k(() => t.allSelected, y), (l, s) => (o(), r("thead", {
51
51
  class: a(B)
52
52
  }, [
53
53
  m("tr", {
@@ -80,8 +80,8 @@ const j = { key: 0 }, N = { key: 1 }, R = ["checked", "aria-checked"], U = ["onC
80
80
  ])) : d("", !0),
81
81
  (o(!0), r(E, null, T(n.headers, (e) => (o(), r("th", {
82
82
  key: e.key,
83
- class: a([i, e.headerAlign === "right" ? "text-right" : e.headerAlign === "center" ? "text-center" : "text-left"]),
84
- onClick: (k) => S(e),
83
+ class: a([i, e.headerAlign === "right" ? "text-right" : e.headerAlign === "left" ? "text-left" : "text-center"]),
84
+ onClick: (f) => S(e),
85
85
  style: $({ cursor: e.sortable ? "pointer" : "default" })
86
86
  }, [
87
87
  g(l.$slots, `header.${e.key}`, { header: e }, () => [
@@ -1,4 +1,4 @@
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 h, renderList as y, unref as g, createTextVNode as S, toDisplayString as f } from "vue";
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
2
  import { getValue as x, formatValue as v } from "../../../../utils/tableFormatters.js";
3
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 = {
4
4
  __name: "KunTableRow",
@@ -59,16 +59,16 @@ const B = { key: 0 }, $ = { key: 1 }, A = ["checked"], E = "hover:bg-slate-300 d
59
59
  class: "h-5 w-5 text-blue-600 transition-all duration-200 ease-in-out rounded"
60
60
  }, null, 40, A)
61
61
  ])) : c("", !0),
62
- (n(!0), s(h, null, y(e.headers, (t) => (n(), s("td", {
62
+ (n(!0), s(f, null, h(e.headers, (t) => (n(), s("td", {
63
63
  key: t.value,
64
- class: a([o, t.align === "right" ? "text-right" : t.align === "center" ? "text-center" : "text-left"])
64
+ class: a([o, t.align === "right" ? "text-right" : t.align === "left" ? "text-left" : "text-center"])
65
65
  }, [
66
66
  m(d.$slots, `item.${t.value}`, {
67
67
  item: e.item,
68
68
  value: g(x)(t, e.item),
69
69
  index: e.index
70
70
  }, () => [
71
- S(f(g(v)(t, g(x)(t, e.item))), 1)
71
+ y(S(g(v)(t, g(x)(t, e.item))), 1)
72
72
  ])
73
73
  ], 2))), 128)),
74
74
  e.hasActions ? (n(), s("td", {
@@ -1,14 +1,14 @@
1
- import { reactive as F, ref as k, computed as w, watch as A } from "vue";
2
- import { debounce as S } from "../../../../utils/utils.js";
3
- function j(i, u) {
4
- const t = F({
1
+ import { reactive as p, ref as F, computed as k, watch as w } from "vue";
2
+ import { debounce as A } from "../../../../utils/utils.js";
3
+ function L(a) {
4
+ const t = p({
5
5
  search: "",
6
6
  byColumn: {}
7
- }), { items: c, customFilter: s, searchableKeys: f } = i, y = k(!1), a = (e, r) => e == null ? !1 : String(e).toLowerCase().includes(String(r).toLowerCase()), l = (e, r, n) => {
7
+ }), { items: c, customFilter: s, searchableKeys: u } = a, f = F(!1), i = (e, r) => e == null ? !1 : String(e).toLowerCase().includes(String(r).toLowerCase()), l = (e, r, n) => {
8
8
  const o = e[r];
9
- return typeof (s == null ? void 0 : s.value) == "function" ? s.value(e, r, n) : Array.isArray(n) ? n.some((b) => a(o, b)) : a(o, n);
10
- }, m = w(() => Array.isArray(c.value) ? c.value.filter((e) => {
11
- if (t.search && !(f.value || Object.keys(e)).some((o) => l(e, o, t.search)))
9
+ return typeof (s == null ? void 0 : s.value) == "function" ? s.value(e, r, n) : Array.isArray(n) ? n.some((b) => i(o, b)) : i(o, n);
10
+ }, m = k(() => Array.isArray(c.value) ? c.value.filter((e) => {
11
+ if (t.search && !(u.value || Object.keys(e)).some((o) => l(e, o, t.search)))
12
12
  return !1;
13
13
  for (const r in t.byColumn) {
14
14
  const n = t.byColumn[r];
@@ -16,28 +16,28 @@ function j(i, u) {
16
16
  return !1;
17
17
  }
18
18
  return !0;
19
- }) : []), h = S((e) => {
19
+ }) : []), y = A((e) => {
20
20
  t.search = (e == null ? void 0 : e.toString().toLowerCase()) || "";
21
- }, u), p = (e, r) => {
21
+ }, a.debounceTime), h = (e, r) => {
22
22
  t.byColumn[e] = r;
23
23
  };
24
- function C(e) {
24
+ function d(e) {
25
25
  for (const r in e)
26
- p(r, e[r]);
26
+ h(r, e[r]);
27
27
  }
28
- const d = () => {
28
+ const C = () => {
29
29
  t.search = "", t.byColumn = {};
30
30
  };
31
- return A(() => c.value, () => {
31
+ return w(() => c.value, () => {
32
32
  }, { deep: !0 }), {
33
- modalFilter: y,
33
+ modalFilter: f,
34
34
  appliedFilters: t,
35
35
  filteredItems: m,
36
- setSearch: h,
37
- applyColumnFilters: C,
38
- clearFilters: d
36
+ setSearch: y,
37
+ applyColumnFilters: d,
38
+ clearFilters: C
39
39
  };
40
40
  }
41
41
  export {
42
- j as default
42
+ L as default
43
43
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.238",
3
+ "version": "0.1.239",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",