adverich-kun-ui 0.1.188 → 0.1.190

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.
@@ -48,7 +48,7 @@ const H = "fixed inset-0 z-250 flex", U = /* @__PURE__ */ x({
48
48
  c();
49
49
  });
50
50
  function d(o) {
51
- console.log(o), o.stopPropagation(), o.key === "Escape" && (console.log("y se"), t.persistent || (console.log("y seeee"), s("update:modelValue", !1)));
51
+ o.stopPropagation(), o.key === "Escape" && (t.persistent || s("update:modelValue", !1));
52
52
  }
53
53
  return f(() => {
54
54
  window.addEventListener("keydown", d);
@@ -1,191 +1,194 @@
1
- import { toRefs as re, ref as ne, watch as ie, computed as L, createElementBlock as n, openBlock as l, mergeProps as A, createCommentVNode as m, createElementVNode as E, renderSlot as a, createBlock as y, unref as e, normalizeClass as M, withDirectives as de, vModelText as pe, normalizeProps as i, guardReactiveProps as u, Fragment as ce, createVNode as B, createSlots as N, renderList as R, withCtx as U, isRef as me } from "vue";
2
- import { isMobile as w } from "../../../../utils/_platform.js";
3
- import ue from "./KunTableHeaders.vue.js";
4
- import ge from "./KunTableFooter.vue.js";
1
+ import { toRefs as re, ref as ne, watch as j, computed as z, createElementBlock as c, openBlock as l, mergeProps as E, createCommentVNode as i, createElementVNode as D, renderSlot as a, createBlock as b, unref as s, normalizeClass as L, withDirectives as ie, vModelText as de, normalizeProps as d, guardReactiveProps as u, Fragment as pe, createVNode as M, createSlots as R, renderList as U, withCtx as I, isRef as ce } from "vue";
2
+ import { isMobile as v } from "../../../../utils/_platform.js";
3
+ import me from "./KunTableHeaders.vue.js";
4
+ import ue from "./KunTableFooter.vue.js";
5
5
  import he from "./KunTableRows.vue.js";
6
- import fe from "./KunTableIterators.vue.js";
7
- import be from "../../../KunBtn/src/components/KunBtn.vue.js";
8
- import ye from "./KunTableFilter.vue.js";
9
- import we from "../../../KunCard/src/components/KunCard.vue.js";
10
- import ve from "../composables/useExpand.js";
11
- import Ce from "../composables/useOptions.js";
6
+ import ge from "./KunTableIterators.vue.js";
7
+ import fe from "../../../KunBtn/src/components/KunBtn.vue.js";
8
+ import be from "./KunTableFilter.vue.js";
9
+ import ye from "../../../KunCard/src/components/KunCard.vue.js";
10
+ import we from "../composables/useExpand.js";
11
+ import ve from "../composables/useOptions.js";
12
12
  import Se from "../composables/useSelect.js";
13
- import $e from "../composables/useFilter.js";
14
- import ke from "../composables/KunTableProps.js";
15
- const Pe = ["placeholder"], Te = { key: 0 }, Fe = { key: 5 }, Ae = ["colspan"], Ee = { key: 6 }, Be = {
13
+ import Ce from "../composables/useFilter.js";
14
+ import $e from "../composables/KunTableProps.js";
15
+ const ke = ["placeholder"], Pe = { key: 0 }, Te = { key: 5 }, Fe = { class: "h-full" }, Ae = {
16
16
  key: 1,
17
17
  class: "sticky bottom-0 z-10"
18
- }, Ve = "overflow-auto h-full w-full flex flex-col border border-slate-200 dark:border-slate-800 rounded", je = "table-auto w-full h-fit text-sm text-left", qe = {
18
+ }, Ee = "overflow-auto h-full w-full flex flex-col border border-slate-200 dark:border-slate-800 rounded", Be = "table-auto w-full h-fit text-sm text-left", He = {
19
19
  __name: "KunTable",
20
- props: ke(),
21
- emits: ["update:page", "update:itemsPerPage", "update:sortBy", "update:selectedItems"],
22
- setup(D, { emit: I }) {
23
- const V = I, d = D, f = re(d), {
24
- headers: b,
25
- showExpand: v,
26
- showSelect: C,
27
- rowClass: j,
28
- hideDefaultFooter: K,
29
- hideDefaultHeader: O,
30
- tableClass: W,
31
- wrapperClass: x,
32
- pageOptions: H,
33
- items: Q,
34
- searchable: z,
35
- debounceTime: q
36
- } = f, S = ne(""), { filteredItems: G, setSearch: J, modalFilter: g, applyColumnFilters: X, clearFilters: Y, appliedFilters: Z } = $e(f, q);
37
- ie(S, (s) => {
38
- J(s);
20
+ props: $e(),
21
+ emits: ["update:page", "update:itemsPerPage", "update:sortBy", "update:selectedItems", "update:search"],
22
+ setup(N, { emit: K }) {
23
+ const S = K, r = N, y = re(r), {
24
+ headers: w,
25
+ showExpand: C,
26
+ showSelect: $,
27
+ rowClass: B,
28
+ hideDefaultFooter: O,
29
+ hideDefaultHeader: W,
30
+ tableClass: x,
31
+ wrapperClass: H,
32
+ pageOptions: Q,
33
+ items: q,
34
+ searchable: V,
35
+ debounceTime: G
36
+ } = y, h = ne(r.search);
37
+ j(() => r.search, (e) => {
38
+ e !== h.value && (h.value = e);
39
39
  });
40
- const { options: r, paginatedItems: p, updateSort: _ } = Ce(f, V, G), { isSelected: $, toggleSelect: k, toggleSelectAll: ee, allSelected: se, someSelected: te } = Se(f, V, p), { isExpanded: P, toggleExpand: T } = ve(), c = L(() => ({
40
+ const { filteredItems: J, setSearch: X, modalFilter: g, applyColumnFilters: Y, clearFilters: Z, appliedFilters: _ } = Ce(y, G);
41
+ j(h, (e) => {
42
+ S("update:search", e), X(e);
43
+ });
44
+ const { options: n, paginatedItems: p, updateSort: ee } = ve(y, S, J), { isSelected: k, toggleSelect: P, toggleSelectAll: se, allSelected: te, someSelected: le } = Se(y, S, p), { isExpanded: T, toggleExpand: F } = we(), m = z(() => ({
41
45
  items: p.value,
42
- headers: b.value,
43
- page: r.page,
44
- itemsPerPage: r.itemsPerPage,
45
- toggleSelect: k,
46
- isSelected: $,
47
- toggleExpand: T,
48
- isExpanded: P,
49
- sortBy: r.sortBy,
50
- hasActions: d.hasActions
51
- })), le = [Ve, x.value], oe = [je, W.value], ae = L(() => {
46
+ headers: w.value,
47
+ page: n.page,
48
+ itemsPerPage: n.itemsPerPage,
49
+ toggleSelect: P,
50
+ isSelected: k,
51
+ toggleExpand: F,
52
+ isExpanded: T,
53
+ sortBy: n.sortBy,
54
+ hasActions: r.hasActions
55
+ })), oe = [Ee, H.value], ae = [Be, x.value];
56
+ return z(() => {
52
57
  var t;
53
- let s = ((t = d.headers) == null ? void 0 : t.length) || 0;
54
- return d.showSelect && (s += 1), d.showExpand && (s += 1), d.hasActions && (s += 1), s;
55
- });
56
- return (s, t) => (l(), n("div", A({ class: le }, s.$attrs, { style: { "user-select": "text" } }), [
57
- e(z) || s.filterable || s.$slots.prependSearch || s.$slots.appendSearch ? (l(), n("div", {
58
+ let e = ((t = r.headers) == null ? void 0 : t.length) || 0;
59
+ return r.showSelect && (e += 1), r.showExpand && (e += 1), r.hasActions && (e += 1), e;
60
+ }), (e, t) => (l(), c("div", E({ class: oe }, e.$attrs, { style: { "user-select": "text" } }), [
61
+ s(V) || e.filterable || e.$slots.prependSearch || e.$slots.appendSearch ? (l(), c("div", {
58
62
  key: 0,
59
- class: M(["p-2 bg-slate-200 dark:bg-slate-800", {
60
- "justify-start flex": s.searchPosition === "start",
61
- "justify-center flex": s.searchPosition === "center",
62
- "justify-end flex": s.searchPosition === "end"
63
+ class: L(["p-2 bg-slate-200 dark:bg-slate-800", {
64
+ "justify-start flex": e.searchPosition === "start",
65
+ "justify-center flex": e.searchPosition === "center",
66
+ "justify-end flex": e.searchPosition === "end"
63
67
  }])
64
68
  }, [
65
- a(s.$slots, "prependSearch"),
66
- s.filterable ? (l(), y(be, {
69
+ a(e.$slots, "prependSearch"),
70
+ e.filterable ? (l(), b(fe, {
67
71
  key: 0,
68
72
  onClick: t[0] || (t[0] = (o) => g.value = !0),
69
73
  text: "Filtrar",
70
74
  bgColor: "bg-slate-300 dark:bg-slate-700"
71
- })) : m("", !0),
72
- e(z) ? de((l(), n("input", {
75
+ })) : i("", !0),
76
+ s(V) ? ie((l(), c("input", {
73
77
  key: 1,
74
- "onUpdate:modelValue": t[1] || (t[1] = (o) => S.value = o),
78
+ "onUpdate:modelValue": t[1] || (t[1] = (o) => h.value = o),
75
79
  type: "text",
76
- placeholder: s.searchPlaceholder,
80
+ placeholder: e.searchPlaceholder,
77
81
  class: "border mx-2 px-3 py-1 rounded w-full max-w-sm text-sm"
78
- }, null, 8, Pe)), [
79
- [pe, S.value]
80
- ]) : m("", !0),
81
- a(s.$slots, "appendSearch")
82
- ], 2)) : m("", !0),
83
- E("table", {
84
- class: M(oe)
82
+ }, null, 8, ke)), [
83
+ [de, h.value]
84
+ ]) : i("", !0),
85
+ a(e.$slots, "appendSearch")
86
+ ], 2)) : i("", !0),
87
+ D("table", {
88
+ class: L(ae)
85
89
  }, [
86
- s.$slots.colgroup && !e(w) ? (l(), n("colgroup", Te, [
87
- a(s.$slots, "colgroup", i(u(c.value)))
88
- ])) : m("", !0),
89
- !e(O) && !e(w) ? (l(), y(ue, {
90
+ e.$slots.colgroup && !s(v) ? (l(), c("colgroup", Pe, [
91
+ a(e.$slots, "colgroup", d(u(m.value)))
92
+ ])) : i("", !0),
93
+ !s(W) && !s(v) ? (l(), b(me, {
90
94
  key: 1,
91
- headers: e(b),
92
- "sort-by": e(r).sortBy,
93
- "show-select": e(C),
94
- "show-expand": e(v),
95
- "all-selected": e(se),
96
- "some-selected": e(te),
97
- "thead-class": s.theadClass,
98
- "tr-class": s.trClass,
99
- "th-class": s.thClass,
100
- "has-actions": s.hasActions,
101
- "action-label": s.actionLabel,
102
- onSort: e(_),
103
- onToggleSelectAll: e(ee)
104
- }, 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(s.$slots, "thead", i(A({ key: 2 }, c.value))),
105
- e(p).length && !e(w) ? (l(), n(ce, { key: 3 }, [
106
- a(s.$slots, "body.prepend", i(u(c.value))),
107
- B(he, {
108
- items: e(p),
109
- headers: e(b),
110
- "tbody-class": s.tbodyClass,
111
- "row-class": e(j),
112
- "tr-class": s.trClass,
113
- "td-class": s.tdClass,
114
- "selected-class": s.selectedClass,
115
- "striped-class": s.stripedClass,
116
- "is-selected": e($),
117
- "is-expanded": e(P),
118
- "show-select": e(C),
119
- "show-expand": e(v),
120
- "has-actions": s.hasActions,
121
- "action-loading-map": s.actionLoadingMap,
122
- onToggleExpand: e(T),
123
- onToggleSelect: e(k)
124
- }, N({ _: 2 }, [
125
- R(s.$slots, (o, h) => ({
126
- name: h,
127
- fn: U((F) => [
128
- a(s.$slots, h, i(u(F)))
95
+ headers: s(w),
96
+ "sort-by": s(n).sortBy,
97
+ "show-select": s($),
98
+ "show-expand": s(C),
99
+ "all-selected": s(te),
100
+ "some-selected": s(le),
101
+ "thead-class": e.theadClass,
102
+ "tr-class": e.trClass,
103
+ "th-class": e.thClass,
104
+ "has-actions": e.hasActions,
105
+ "action-label": e.actionLabel,
106
+ onSort: s(ee),
107
+ onToggleSelectAll: s(se)
108
+ }, 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(E({ key: 2 }, m.value))),
109
+ s(p).length && !s(v) ? (l(), c(pe, { key: 3 }, [
110
+ a(e.$slots, "body.prepend", d(u(m.value))),
111
+ M(he, {
112
+ items: s(p),
113
+ headers: s(w),
114
+ "tbody-class": e.tbodyClass,
115
+ "row-class": s(B),
116
+ "tr-class": e.trClass,
117
+ "td-class": e.tdClass,
118
+ "selected-class": e.selectedClass,
119
+ "striped-class": e.stripedClass,
120
+ "is-selected": s(k),
121
+ "is-expanded": s(T),
122
+ "show-select": s($),
123
+ "show-expand": s(C),
124
+ "has-actions": e.hasActions,
125
+ "action-loading-map": e.actionLoadingMap,
126
+ onToggleExpand: s(F),
127
+ onToggleSelect: s(P)
128
+ }, R({ _: 2 }, [
129
+ U(e.$slots, (o, f) => ({
130
+ name: f,
131
+ fn: I((A) => [
132
+ a(e.$slots, f, d(u(A)))
129
133
  ])
130
134
  }))
131
135
  ]), 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"]),
132
- a(s.$slots, "body.append", i(u(c.value)))
133
- ], 64)) : e(p).length && e(w) ? (l(), y(fe, {
136
+ a(e.$slots, "body.append", d(u(m.value)))
137
+ ], 64)) : s(p).length && s(v) ? (l(), b(ge, {
134
138
  key: 4,
135
- items: e(p),
136
- headers: e(b),
137
- "row-class": e(j),
138
- "is-selected": e($),
139
- "is-expanded": e(P),
140
- "show-select": e(C),
141
- "show-expand": e(v),
142
- "has-actions": s.hasActions,
143
- "action-loading-map": s.actionLoadingMap,
144
- onToggleExpand: e(T),
145
- onToggleSelect: e(k)
146
- }, N({ _: 2 }, [
147
- R(s.$slots, (o, h) => ({
148
- name: h,
149
- fn: U((F) => [
150
- a(s.$slots, h, i(u(F)))
139
+ items: s(p),
140
+ headers: s(w),
141
+ "row-class": s(B),
142
+ "is-selected": s(k),
143
+ "is-expanded": s(T),
144
+ "show-select": s($),
145
+ "show-expand": s(C),
146
+ "has-actions": e.hasActions,
147
+ "action-loading-map": e.actionLoadingMap,
148
+ onToggleExpand: s(F),
149
+ onToggleSelect: s(P)
150
+ }, R({ _: 2 }, [
151
+ U(e.$slots, (o, f) => ({
152
+ name: f,
153
+ fn: I((A) => [
154
+ a(e.$slots, f, d(u(A)))
151
155
  ])
152
156
  }))
153
- ]), 1032, ["items", "headers", "row-class", "is-selected", "is-expanded", "show-select", "show-expand", "has-actions", "action-loading-map", "onToggleExpand", "onToggleSelect"])) : (l(), n("tr", Fe, [
154
- E("td", { colspan: ae.value }, [
155
- B(we, {
156
- class: "h-full flex justify-center items-center",
157
- title: "No hay elementos disponibles",
158
- titleSize: "text-4xl"
159
- })
160
- ], 8, Ae)
161
- ])),
162
- s.$slots.tfoot ? (l(), n("tfoot", Ee, [
163
- a(s.$slots, "tfoot", i(u(c.value)))
164
- ])) : m("", !0)
157
+ ]), 1032, ["items", "headers", "row-class", "is-selected", "is-expanded", "show-select", "show-expand", "has-actions", "action-loading-map", "onToggleExpand", "onToggleSelect"])) : i("", !0),
158
+ e.$slots.tfoot ? (l(), c("tfoot", Te, [
159
+ a(e.$slots, "tfoot", d(u(m.value)))
160
+ ])) : i("", !0)
161
+ ]),
162
+ D("div", Fe, [
163
+ s(p).length ? i("", !0) : (l(), b(ye, {
164
+ key: 0,
165
+ class: "h-full flex justify-center items-center",
166
+ title: e.noDataText,
167
+ titleSize: "text-4xl"
168
+ }, null, 8, ["title"]))
165
169
  ]),
166
- t[5] || (t[5] = E("div", { class: "h-full" }, null, -1)),
167
- e(K) ? a(s.$slots, "footer", i(A({ key: 2 }, c.value))) : (l(), n("div", Be, [
168
- B(ge, {
169
- "items-length": e(Q).length,
170
- "items-per-page": e(r).itemsPerPage,
171
- "current-page": e(r).page,
172
- "page-options": e(H),
173
- "onUpdate:itemsPerPage": t[2] || (t[2] = (o) => e(r).itemsPerPage = o),
174
- "onUpdate:page": t[3] || (t[3] = (o) => e(r).page = o)
170
+ s(O) ? a(e.$slots, "footer", d(E({ key: 2 }, m.value))) : (l(), c("div", Ae, [
171
+ M(ue, {
172
+ "items-length": s(q).length,
173
+ "items-per-page": s(n).itemsPerPage,
174
+ "current-page": s(n).page,
175
+ "page-options": s(Q),
176
+ "onUpdate:itemsPerPage": t[2] || (t[2] = (o) => s(n).itemsPerPage = o),
177
+ "onUpdate:page": t[3] || (t[3] = (o) => s(n).page = o)
175
178
  }, null, 8, ["items-length", "items-per-page", "current-page", "page-options"])
176
179
  ])),
177
- s.filterable && e(g) ? (l(), y(ye, {
180
+ e.filterable && s(g) ? (l(), b(be, {
178
181
  key: 3,
179
- filters: s.filters,
180
- modelValue: e(g),
181
- "onUpdate:modelValue": t[4] || (t[4] = (o) => me(g) ? g.value = o : null),
182
- onApplyFilters: e(X),
183
- onClearFilters: e(Y),
184
- activeFilters: e(Z).byColumn
185
- }, null, 8, ["filters", "modelValue", "onApplyFilters", "onClearFilters", "activeFilters"])) : m("", !0)
182
+ filters: e.filters,
183
+ modelValue: s(g),
184
+ "onUpdate:modelValue": t[4] || (t[4] = (o) => ce(g) ? g.value = o : null),
185
+ onApplyFilters: s(Y),
186
+ onClearFilters: s(Z),
187
+ activeFilters: s(_).byColumn
188
+ }, null, 8, ["filters", "modelValue", "onApplyFilters", "onClearFilters", "activeFilters"])) : i("", !0)
186
189
  ], 16));
187
190
  }
188
191
  };
189
192
  export {
190
- qe as default
193
+ He as default
191
194
  };
@@ -18,6 +18,10 @@ const t = () => ({
18
18
  mutliSort: Boolean,
19
19
  pageOptions: { type: Array, default: () => [5, 10, 25, 50, 100] },
20
20
  searchable: { type: Boolean, default: !1 },
21
+ search: {
22
+ type: String,
23
+ default: ""
24
+ },
21
25
  searchableKeys: { type: Array, default: null },
22
26
  searchPosition: {
23
27
  type: String,
@@ -46,8 +50,8 @@ const t = () => ({
46
50
  tfootClass: { type: String, default: "" },
47
51
  rowClass: { type: String, default: "" },
48
52
  // Misc
49
- noDataText: { type: String, default: "No data available" },
50
- loadingText: { type: String, default: "Loading..." },
53
+ noDataText: { type: String, default: "No hay elementos disponibles" },
54
+ loadingText: { type: String, default: "Cargando..." },
51
55
  // Slots control
52
56
  showTopSlot: { type: Boolean, default: !1 },
53
57
  showBottomSlot: { type: Boolean, default: !1 }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.188",
3
+ "version": "0.1.190",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",