adverich-kun-ui 0.1.188 → 0.1.189

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,8 +1,8 @@
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";
1
+ import { toRefs as ne, ref as ie, watch as L, computed as M, createElementBlock as i, openBlock as l, mergeProps as E, createCommentVNode as m, createElementVNode as B, renderSlot as a, createBlock as w, unref as s, normalizeClass as N, withDirectives as de, vModelText as pe, normalizeProps as d, guardReactiveProps as u, Fragment as ce, createVNode as V, createSlots as R, renderList as U, withCtx as D, isRef as me } from "vue";
2
+ import { isMobile as v } from "../../../../utils/_platform.js";
3
3
  import ue from "./KunTableHeaders.vue.js";
4
- import ge from "./KunTableFooter.vue.js";
5
- import he from "./KunTableRows.vue.js";
4
+ import he from "./KunTableFooter.vue.js";
5
+ import ge from "./KunTableRows.vue.js";
6
6
  import fe from "./KunTableIterators.vue.js";
7
7
  import be from "../../../KunBtn/src/components/KunBtn.vue.js";
8
8
  import ye from "./KunTableFilter.vue.js";
@@ -18,170 +18,174 @@ const Pe = ["placeholder"], Te = { key: 0 }, Fe = { key: 5 }, Ae = ["colspan"],
18
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 = {
19
19
  __name: "KunTable",
20
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,
21
+ emits: ["update:page", "update:itemsPerPage", "update:sortBy", "update:selectedItems", "update:search"],
22
+ setup(I, { emit: K }) {
23
+ const C = K, r = I, b = ne(r), {
24
+ headers: y,
25
+ showExpand: S,
26
+ showSelect: $,
27
27
  rowClass: j,
28
- hideDefaultFooter: K,
29
- hideDefaultHeader: O,
30
- tableClass: W,
31
- wrapperClass: x,
32
- pageOptions: H,
33
- items: Q,
28
+ hideDefaultFooter: O,
29
+ hideDefaultHeader: W,
30
+ tableClass: x,
31
+ wrapperClass: H,
32
+ pageOptions: Q,
33
+ items: q,
34
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);
35
+ debounceTime: G
36
+ } = b, h = ie(r.search);
37
+ L(() => 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: _ } = $e(b, G);
41
+ L(h, (e) => {
42
+ C("update:search", e), X(e);
43
+ });
44
+ const { options: n, paginatedItems: p, updateSort: ee } = Ce(b, C, J), { isSelected: k, toggleSelect: P, toggleSelectAll: se, allSelected: te, someSelected: le } = Se(b, C, p), { isExpanded: T, toggleExpand: F } = ve(), c = M(() => ({
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: y.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 = [Ve, H.value], ae = [je, x.value], re = M(() => {
52
56
  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;
57
+ let e = ((t = r.headers) == null ? void 0 : t.length) || 0;
58
+ return r.showSelect && (e += 1), r.showExpand && (e += 1), r.hasActions && (e += 1), e;
55
59
  });
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", {
60
+ return (e, t) => (l(), i("div", E({ class: oe }, e.$attrs, { style: { "user-select": "text" } }), [
61
+ s(z) || e.filterable || e.$slots.prependSearch || e.$slots.appendSearch ? (l(), i("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: N(["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(), w(be, {
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
75
  })) : m("", !0),
72
- e(z) ? de((l(), n("input", {
76
+ s(z) ? de((l(), i("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
82
  }, null, 8, Pe)), [
79
- [pe, S.value]
83
+ [pe, h.value]
80
84
  ]) : m("", !0),
81
- a(s.$slots, "appendSearch")
85
+ a(e.$slots, "appendSearch")
82
86
  ], 2)) : m("", !0),
83
- E("table", {
84
- class: M(oe)
87
+ B("table", {
88
+ class: N(ae)
85
89
  }, [
86
- s.$slots.colgroup && !e(w) ? (l(), n("colgroup", Te, [
87
- a(s.$slots, "colgroup", i(u(c.value)))
90
+ e.$slots.colgroup && !s(v) ? (l(), i("colgroup", Te, [
91
+ a(e.$slots, "colgroup", d(u(c.value)))
88
92
  ])) : m("", !0),
89
- !e(O) && !e(w) ? (l(), y(ue, {
93
+ !s(W) && !s(v) ? (l(), w(ue, {
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(y),
96
+ "sort-by": s(n).sortBy,
97
+ "show-select": s($),
98
+ "show-expand": s(S),
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 }, c.value))),
109
+ s(p).length && !s(v) ? (l(), i(ce, { key: 3 }, [
110
+ a(e.$slots, "body.prepend", d(u(c.value))),
111
+ V(ge, {
112
+ items: s(p),
113
+ headers: s(y),
114
+ "tbody-class": e.tbodyClass,
115
+ "row-class": s(j),
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(S),
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: D((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(c.value)))
137
+ ], 64)) : s(p).length && s(v) ? (l(), w(fe, {
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(y),
141
+ "row-class": s(j),
142
+ "is-selected": s(k),
143
+ "is-expanded": s(T),
144
+ "show-select": s($),
145
+ "show-expand": s(S),
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: D((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, {
157
+ ]), 1032, ["items", "headers", "row-class", "is-selected", "is-expanded", "show-select", "show-expand", "has-actions", "action-loading-map", "onToggleExpand", "onToggleSelect"])) : (l(), i("tr", Fe, [
158
+ B("td", { colspan: re.value }, [
159
+ V(we, {
156
160
  class: "h-full flex justify-center items-center",
157
161
  title: "No hay elementos disponibles",
158
162
  titleSize: "text-4xl"
159
163
  })
160
164
  ], 8, Ae)
161
165
  ])),
162
- s.$slots.tfoot ? (l(), n("tfoot", Ee, [
163
- a(s.$slots, "tfoot", i(u(c.value)))
166
+ e.$slots.tfoot ? (l(), i("tfoot", Ee, [
167
+ a(e.$slots, "tfoot", d(u(c.value)))
164
168
  ])) : m("", !0)
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
+ t[5] || (t[5] = B("div", { class: "h-full" }, null, -1)),
171
+ s(O) ? a(e.$slots, "footer", d(E({ key: 2 }, c.value))) : (l(), i("div", Be, [
172
+ V(he, {
173
+ "items-length": s(q).length,
174
+ "items-per-page": s(n).itemsPerPage,
175
+ "current-page": s(n).page,
176
+ "page-options": s(Q),
177
+ "onUpdate:itemsPerPage": t[2] || (t[2] = (o) => s(n).itemsPerPage = o),
178
+ "onUpdate:page": t[3] || (t[3] = (o) => s(n).page = o)
175
179
  }, null, 8, ["items-length", "items-per-page", "current-page", "page-options"])
176
180
  ])),
177
- s.filterable && e(g) ? (l(), y(ye, {
181
+ e.filterable && s(g) ? (l(), w(ye, {
178
182
  key: 3,
179
- filters: s.filters,
180
- modelValue: e(g),
183
+ filters: e.filters,
184
+ modelValue: s(g),
181
185
  "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
186
+ onApplyFilters: s(Y),
187
+ onClearFilters: s(Z),
188
+ activeFilters: s(_).byColumn
185
189
  }, null, 8, ["filters", "modelValue", "onApplyFilters", "onClearFilters", "activeFilters"])) : m("", !0)
186
190
  ], 16));
187
191
  }
@@ -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,
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.189",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",