adverich-kun-ui 0.1.312 → 0.1.313

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,217 +1,248 @@
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
- import { isMobile as b } from "../../../../utils/_platform.js";
3
- import he from "./KunTableHeaders.vue.js";
4
- import ye from "./KunTableFooter.vue.js";
5
- import we from "./KunTableRows.vue.js";
6
- import be from "./KunTableIterators.vue.js";
7
- import ve from "../../../KunBtn/src/components/KunBtn.vue.js";
8
- import Se from "./KunTableFilter.vue.js";
9
- import Ce from "../../../KunCard/src/components/KunCard.vue.js";
10
- import Te from "../composables/useExpand.js";
11
- import $e from "../composables/useOptions.js";
12
- import Fe from "../composables/useSelect.js";
13
- import ke from "../composables/useFilter.js";
14
- import Pe from "../composables/KunTableProps.js";
15
- const Ae = ["placeholder"], Me = { class: "flex-1 overflow-auto" }, Ee = { key: 0 }, Re = { key: 5 }, Be = {
1
+ import { mergeModels as O, toRefs as ye, useModel as be, ref as y, watch as W, computed as Q, onMounted as Se, createElementBlock as c, openBlock as l, mergeProps as B, createCommentVNode as u, createElementVNode as V, renderSlot as a, createBlock as b, unref as s, normalizeClass as S, withDirectives as q, vModelText as Ce, vShow as G, createVNode as C, normalizeProps as d, guardReactiveProps as g, Fragment as Te, createSlots as J, renderList as X, withCtx as Y, isRef as $e, nextTick as Fe } from "vue";
2
+ import { isMobile as p } from "../../../../utils/_platform.js";
3
+ import ke from "../../../KunIcon/src/components/KunIcon.vue.js";
4
+ import Pe from "../../../../icons/IconSearch.vue.js";
5
+ import Me from "./KunTableHeaders.vue.js";
6
+ import Ae from "./KunTableFooter.vue.js";
7
+ import Re from "./KunTableRows.vue.js";
8
+ import Ee from "./KunTableIterators.vue.js";
9
+ import Ie from "../../../KunBtn/src/components/KunBtn.vue.js";
10
+ import Be from "./KunTableFilter.vue.js";
11
+ import Ve from "../../../KunCard/src/components/KunCard.vue.js";
12
+ import xe from "../composables/useExpand.js";
13
+ import je from "../composables/useOptions.js";
14
+ import Ne from "../composables/useSelect.js";
15
+ import ze from "../composables/useFilter.js";
16
+ import De from "../composables/KunTableProps.js";
17
+ const Ke = ["placeholder"], Le = { class: "flex-1 overflow-auto" }, Ue = { key: 0 }, He = { key: 5 }, Oe = {
16
18
  key: 0,
17
19
  class: "h-full"
18
- }, Ie = {
20
+ }, We = {
19
21
  key: 1,
20
22
  class: "sticky bottom-0 z-10 print:hidden"
21
- }, Ve = "overflow-hidden 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", Xe = {
23
+ }, Qe = "overflow-hidden h-full w-full flex flex-col border border-slate-200 dark:border-slate-800 rounded", qe = "table-auto w-full h-fit text-sm text-left", us = {
22
24
  __name: "KunTable",
23
- props: /* @__PURE__ */ j(Pe(), {
25
+ props: /* @__PURE__ */ O(De(), {
24
26
  selectedItems: { type: Array, default: () => [] },
25
27
  selectedItemsModifiers: {}
26
28
  }),
27
- emits: /* @__PURE__ */ j(["update:page", "update:itemsPerPage", "update:sortBy", "update:search"], ["update:selectedItems"]),
28
- setup(M, { emit: H }) {
29
- const E = H, u = M, v = ce(u), O = de(M, "selectedItems"), {
30
- headers: R,
31
- showExpand: S,
32
- showSelect: C,
33
- rowClass: B,
34
- hideDefaultFooter: W,
35
- hideDefaultHeader: Q,
36
- tableClass: q,
37
- wrapperClass: G,
38
- pageOptions: J,
39
- items: X,
40
- searchable: I,
41
- debounceTime: Y
42
- } = v, h = pe(u.search);
43
- N(() => u.search, (e) => {
44
- e !== h.value && (h.value = e);
29
+ emits: /* @__PURE__ */ O(["update:page", "update:itemsPerPage", "update:sortBy", "update:search"], ["update:selectedItems"]),
30
+ setup(x, { emit: Z }) {
31
+ const j = Z, m = x, T = ye(m), _ = be(x, "selectedItems"), {
32
+ headers: N,
33
+ showExpand: $,
34
+ showSelect: F,
35
+ rowClass: z,
36
+ hideDefaultFooter: ee,
37
+ hideDefaultHeader: se,
38
+ tableClass: oe,
39
+ wrapperClass: te,
40
+ pageOptions: le,
41
+ items: ae,
42
+ searchable: D,
43
+ debounceTime: ne
44
+ } = T, w = y(m.search);
45
+ W(() => m.search, (e) => {
46
+ e !== w.value && (w.value = e);
45
47
  });
46
- const { filteredItems: Z, setSearch: _, modalFilter: y, applyColumnFilters: ee, clearFilters: se, appliedFilters: te } = ke(v, Y);
47
- N(h, (e) => {
48
- E("update:search", e), _(e);
48
+ const { filteredItems: re, setSearch: ie, modalFilter: v, applyColumnFilters: ce, clearFilters: ue, appliedFilters: de } = ze(T, ne);
49
+ W(w, (e) => {
50
+ j("update:search", e), ie(e);
49
51
  });
50
- const { options: r, paginatedItems: m, updateSort: oe } = $e(v, E, Z), { isSelected: T, toggleSelect: $, toggleSelectAll: le, allSelected: ae, someSelected: ne } = Fe(m, O), { isExpanded: F, toggleExpand: k } = Te(), f = z(() => ({
51
- items: m.value,
52
- headers: R.value,
52
+ const { options: r, paginatedItems: f, updateSort: pe } = je(T, j, re), { isSelected: k, toggleSelect: P, toggleSelectAll: me, allSelected: fe, someSelected: he } = Ne(f, _), { isExpanded: M, toggleExpand: A } = xe(), h = Q(() => ({
53
+ items: f.value,
54
+ headers: N.value,
53
55
  page: r.page,
54
56
  itemsPerPage: r.itemsPerPage,
55
- toggleSelect: $,
56
- isSelected: T,
57
- toggleExpand: k,
58
- isExpanded: F,
57
+ toggleSelect: P,
58
+ isSelected: k,
59
+ toggleExpand: A,
60
+ isExpanded: M,
59
61
  sortBy: r.sortBy,
60
- hasActions: u.hasActions
61
- })), re = [Ve, G.value], ie = [je, q.value], V = z(() => u.headers.map((e) => {
62
- var o, i;
63
- const t = { ...e };
62
+ hasActions: m.hasActions
63
+ })), ge = [Qe, te.value], we = [qe, oe.value], K = Q(() => m.headers.map((e) => {
64
+ var t, i;
65
+ const o = { ...e };
64
66
  if ((e.columnType === "function" || e.columnType == "objectFunction" || e.columnType == "simpleFunction") && typeof e.columnFunction == "string") {
65
- const n = (o = u.functionMap) == null ? void 0 : o[e.columnFunction];
66
- typeof n == "function" ? t.columnFunction = n : (console.warn(
67
+ const n = (t = m.functionMap) == null ? void 0 : t[e.columnFunction];
68
+ typeof n == "function" ? o.columnFunction = n : (console.warn(
67
69
  `[KunTable] No se encontró la función "${e.columnFunction}" en functionMap`
68
- ), t.columnFunction = () => "");
70
+ ), o.columnFunction = () => "");
69
71
  }
70
72
  if (e.columnFormat === "function" && typeof e.columnRowText == "string") {
71
- const n = (i = u.functionMap) == null ? void 0 : i[e.columnRowText];
72
- typeof n == "function" ? t.columnRowText = n : (console.warn(
73
+ const n = (i = m.functionMap) == null ? void 0 : i[e.columnRowText];
74
+ typeof n == "function" ? o.columnRowText = n : (console.warn(
73
75
  `[KunTable] No se encontró la función "${e.columnRowText}" en functionMap`
74
- ), t.columnRowText = () => "");
76
+ ), o.columnRowText = () => "");
75
77
  }
76
- return t;
78
+ return o;
77
79
  }));
78
- return (e, t) => (l(), c("div", P({ class: re }, e.$attrs, { style: { "user-select": "text" } }), [
79
- s(I) || e.filterable || e.$slots.prependSearch || e.$slots.appendSearch ? (l(), c("div", {
80
+ Se(() => U());
81
+ const L = y(null), R = y(!0), E = y(!1);
82
+ function ve() {
83
+ p.value && (H(), Fe(() => {
84
+ L.value.focus();
85
+ }));
86
+ }
87
+ function U() {
88
+ p.value && (I.value = "w-fit", R.value = !1, E.value = !0);
89
+ }
90
+ function H() {
91
+ p.value && (I.value = "w-full border", E.value = !1, R.value = !0);
92
+ }
93
+ const I = y("w-full border max-w-sm");
94
+ return (e, o) => (l(), c("div", B({ class: ge }, e.$attrs, { style: { "user-select": "text" } }), [
95
+ s(D) || e.filterable || e.$slots.prependSearch || e.$slots.appendSearch ? (l(), c("div", {
80
96
  key: 0,
81
- class: K(["p-2 bg-slate-200 dark:bg-slate-800 print:hidden", {
97
+ class: S(["p-2 bg-slate-200 dark:bg-slate-800 print:hidden", {
82
98
  "justify-start flex": e.searchPosition === "start",
83
99
  "justify-center flex": e.searchPosition === "center",
84
100
  "justify-end flex": e.searchPosition === "end"
85
101
  }])
86
102
  }, [
87
103
  a(e.$slots, "prependSearch"),
88
- e.filterable && e.filters.length ? (l(), w(ve, {
104
+ e.filterable && e.filters.length ? (l(), b(Ie, {
89
105
  key: 0,
90
- onClick: t[0] || (t[0] = (o) => y.value = !0),
106
+ onClick: o[0] || (o[0] = (t) => v.value = !0),
91
107
  text: "Filtros",
92
108
  bgColor: "bg-green-200 dark:bg-green-800 px-2"
93
- })) : d("", !0),
94
- s(I) ? ue((l(), c("input", {
109
+ })) : u("", !0),
110
+ s(D) ? (l(), c("div", {
95
111
  key: 1,
96
- "onUpdate:modelValue": t[1] || (t[1] = (o) => h.value = o),
97
- type: "text",
98
- placeholder: e.searchPlaceholder,
99
- class: "border mx-2 px-3 py-1 rounded w-full max-w-sm text-sm"
100
- }, null, 8, Ae)), [
101
- [me, h.value]
102
- ]) : d("", !0),
112
+ class: S(["rounded flex mx-2", [I.value]])
113
+ }, [
114
+ q(V("input", {
115
+ "onUpdate:modelValue": o[1] || (o[1] = (t) => w.value = t),
116
+ type: "text",
117
+ placeholder: e.searchPlaceholder,
118
+ class: S(["w-full text-sm", s(p) ? "px-1" : "px-2 py-1"]),
119
+ ref_key: "searchRef",
120
+ ref: L,
121
+ onFocus: H,
122
+ onBlur: U
123
+ }, null, 42, Ke), [
124
+ [Ce, w.value],
125
+ [G, R.value]
126
+ ]),
127
+ q(C(ke, {
128
+ icon: Pe,
129
+ onClick: ve
130
+ }, null, 512), [
131
+ [G, E.value]
132
+ ])
133
+ ], 2)) : u("", !0),
103
134
  a(e.$slots, "appendSearch")
104
- ], 2)) : d("", !0),
105
- D("div", Me, [
106
- D("table", {
107
- class: K(ie)
135
+ ], 2)) : u("", !0),
136
+ V("div", Le, [
137
+ V("table", {
138
+ class: S(we)
108
139
  }, [
109
- e.$slots.colgroup && !s(b) ? (l(), c("colgroup", Ee, [
110
- a(e.$slots, "colgroup", p(g(f.value)))
111
- ])) : d("", !0),
112
- !s(Q) && !s(b) ? (l(), w(he, {
140
+ e.$slots.colgroup && !s(p) ? (l(), c("colgroup", Ue, [
141
+ a(e.$slots, "colgroup", d(g(h.value)))
142
+ ])) : u("", !0),
143
+ !s(se) && !s(p) ? (l(), b(Me, {
113
144
  key: 1,
114
- headers: s(R),
145
+ headers: s(N),
115
146
  "sort-by": s(r).sortBy,
116
- "show-select": s(C),
117
- "show-expand": s(S),
118
- "all-selected": s(ae),
119
- "some-selected": s(ne),
147
+ "show-select": s(F),
148
+ "show-expand": s($),
149
+ "all-selected": s(fe),
150
+ "some-selected": s(he),
120
151
  "thead-class": e.theadClass,
121
152
  "tr-class": e.trClass,
122
153
  "th-class": e.thClass,
123
154
  "has-actions": e.hasActions,
124
155
  "action-label": e.actionLabel,
125
- onSort: s(oe),
126
- onToggleSelectAll: s(le)
127
- }, 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", p(P({ key: 2 }, f.value))),
128
- s(m).length && !s(b) ? (l(), c(fe, { key: 3 }, [
129
- a(e.$slots, "body.prepend", p(g(f.value))),
130
- A(we, {
131
- items: s(m),
132
- headers: V.value,
156
+ onSort: s(pe),
157
+ onToggleSelectAll: s(me)
158
+ }, 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(B({ key: 2 }, h.value))),
159
+ s(f).length && !s(p) ? (l(), c(Te, { key: 3 }, [
160
+ a(e.$slots, "body.prepend", d(g(h.value))),
161
+ C(Re, {
162
+ items: s(f),
163
+ headers: K.value,
133
164
  "tbody-class": e.tbodyClass,
134
- "row-class": s(B),
165
+ "row-class": s(z),
135
166
  "row-class-condition": e.rowClassCondition,
136
167
  "tr-class": e.trClass,
137
168
  "td-class": e.tdClass,
138
169
  "selected-class": e.selectedClass,
139
170
  "striped-class": e.stripedClass,
140
- "is-selected": s(T),
141
- "is-expanded": s(F),
142
- "show-select": s(C),
143
- "show-expand": s(S),
171
+ "is-selected": s(k),
172
+ "is-expanded": s(M),
173
+ "show-select": s(F),
174
+ "show-expand": s($),
144
175
  "has-actions": e.hasActions,
145
176
  "action-loading-map": e.actionLoadingMap,
146
- onToggleExpand: s(k),
147
- onToggleSelect: s($),
177
+ onToggleExpand: s(A),
178
+ onToggleSelect: s(P),
148
179
  customSlots: e.customSlots
149
- }, L({ _: 2 }, [
150
- U(e.$slots, (o, i) => ({
180
+ }, J({ _: 2 }, [
181
+ X(e.$slots, (t, i) => ({
151
182
  name: i,
152
- fn: x((n) => [
153
- a(e.$slots, i, p(g(n)))
183
+ fn: Y((n) => [
184
+ a(e.$slots, i, d(g(n)))
154
185
  ])
155
186
  }))
156
187
  ]), 1032, ["items", "headers", "tbody-class", "row-class", "row-class-condition", "tr-class", "td-class", "selected-class", "striped-class", "is-selected", "is-expanded", "show-select", "show-expand", "has-actions", "action-loading-map", "onToggleExpand", "onToggleSelect", "customSlots"]),
157
- a(e.$slots, "body.append", p(g(f.value)))
158
- ], 64)) : s(m).length && s(b) ? (l(), w(be, {
188
+ a(e.$slots, "body.append", d(g(h.value)))
189
+ ], 64)) : s(f).length && s(p) ? (l(), b(Ee, {
159
190
  key: 4,
160
- items: s(m),
161
- headers: V.value,
162
- "row-class": s(B),
191
+ items: s(f),
192
+ headers: K.value,
193
+ "row-class": s(z),
163
194
  "row-class-condition": e.rowClassCondition,
164
- "is-selected": s(T),
165
- "is-expanded": s(F),
166
- "show-select": s(C),
167
- "show-expand": s(S),
195
+ "is-selected": s(k),
196
+ "is-expanded": s(M),
197
+ "show-select": s(F),
198
+ "show-expand": s($),
168
199
  "has-actions": e.hasActions,
169
200
  "action-loading-map": e.actionLoadingMap,
170
- onToggleExpand: s(k),
171
- onToggleSelect: s($),
201
+ onToggleExpand: s(A),
202
+ onToggleSelect: s(P),
172
203
  customSlots: e.customSlots
173
- }, L({ _: 2 }, [
174
- U(e.$slots, (o, i) => ({
204
+ }, J({ _: 2 }, [
205
+ X(e.$slots, (t, i) => ({
175
206
  name: i,
176
- fn: x((n) => [
177
- a(e.$slots, i, p(g(n)))
207
+ fn: Y((n) => [
208
+ a(e.$slots, i, d(g(n)))
178
209
  ])
179
210
  }))
180
- ]), 1032, ["items", "headers", "row-class", "row-class-condition", "is-selected", "is-expanded", "show-select", "show-expand", "has-actions", "action-loading-map", "onToggleExpand", "onToggleSelect", "customSlots"])) : d("", !0),
181
- e.$slots.tfoot ? (l(), c("tfoot", Re, [
182
- a(e.$slots, "tfoot", p(g(f.value)))
183
- ])) : d("", !0)
211
+ ]), 1032, ["items", "headers", "row-class", "row-class-condition", "is-selected", "is-expanded", "show-select", "show-expand", "has-actions", "action-loading-map", "onToggleExpand", "onToggleSelect", "customSlots"])) : u("", !0),
212
+ e.$slots.tfoot ? (l(), c("tfoot", He, [
213
+ a(e.$slots, "tfoot", d(g(h.value)))
214
+ ])) : u("", !0)
184
215
  ]),
185
- s(m).length ? d("", !0) : (l(), c("div", Be, [
186
- A(Ce, {
216
+ s(f).length ? u("", !0) : (l(), c("div", Oe, [
217
+ C(Ve, {
187
218
  class: "h-full flex justify-center items-center text-center",
188
219
  title: e.noDataText,
189
220
  titleSize: "text-4xl"
190
221
  }, null, 8, ["title"])
191
222
  ]))
192
223
  ]),
193
- s(W) ? a(e.$slots, "footer", p(P({ key: 2 }, f.value))) : (l(), c("div", Ie, [
194
- A(ye, {
195
- "items-length": s(X).length,
224
+ s(ee) ? a(e.$slots, "footer", d(B({ key: 2 }, h.value))) : (l(), c("div", We, [
225
+ C(Ae, {
226
+ "items-length": s(ae).length,
196
227
  "items-per-page": s(r).itemsPerPage,
197
228
  "current-page": s(r).page,
198
- "page-options": s(J),
199
- "onUpdate:itemsPerPage": t[2] || (t[2] = (o) => s(r).itemsPerPage = o),
200
- "onUpdate:page": t[3] || (t[3] = (o) => s(r).page = o)
229
+ "page-options": s(le),
230
+ "onUpdate:itemsPerPage": o[2] || (o[2] = (t) => s(r).itemsPerPage = t),
231
+ "onUpdate:page": o[3] || (o[3] = (t) => s(r).page = t)
201
232
  }, null, 8, ["items-length", "items-per-page", "current-page", "page-options"])
202
233
  ])),
203
- e.filterable && s(y) ? (l(), w(Se, {
234
+ e.filterable && s(v) ? (l(), b(Be, {
204
235
  key: 3,
205
236
  filters: e.filters,
206
- modelValue: s(y),
207
- "onUpdate:modelValue": t[4] || (t[4] = (o) => ge(y) ? y.value = o : null),
208
- onApplyFilters: s(ee),
209
- onClearFilters: s(se),
210
- activeFilters: s(te).byColumn
211
- }, null, 8, ["filters", "modelValue", "onApplyFilters", "onClearFilters", "activeFilters"])) : d("", !0)
237
+ modelValue: s(v),
238
+ "onUpdate:modelValue": o[4] || (o[4] = (t) => $e(v) ? v.value = t : null),
239
+ onApplyFilters: s(ce),
240
+ onClearFilters: s(ue),
241
+ activeFilters: s(de).byColumn
242
+ }, null, 8, ["filters", "modelValue", "onApplyFilters", "onClearFilters", "activeFilters"])) : u("", !0)
212
243
  ], 16));
213
244
  }
214
245
  };
215
246
  export {
216
- Xe as default
247
+ us as default
217
248
  };
@@ -1,16 +1,20 @@
1
- import { createElementBlock as o, openBlock as t, createElementVNode as r } from "vue";
1
+ import { createElementBlock as e, openBlock as o, createElementVNode as r } from "vue";
2
2
  import n from "../_virtual/_plugin-vue_export-helper.js";
3
3
  const c = {}, l = {
4
4
  xmlns: "http://www.w3.org/2000/svg",
5
- viewBox: "0 0 24 24",
6
- fill: "currentColor"
5
+ width: "24",
6
+ height: "24",
7
+ viewBox: "0 0 24 24"
7
8
  };
8
- function s(f, e) {
9
- return t(), o("svg", l, e[0] || (e[0] = [
10
- r("path", { d: "M6 18L18 6M6 6l12 12" }, null, -1)
9
+ function s(T, t) {
10
+ return o(), e("svg", l, t[0] || (t[0] = [
11
+ r("path", {
12
+ fill: "currentColor",
13
+ d: "M9.5 16q-2.725 0-4.612-1.888T3 9.5t1.888-4.612T9.5 3t4.613 1.888T16 9.5q0 1.1-.35 2.075T14.7 13.3l5.6 5.6q.275.275.275.7t-.275.7t-.7.275t-.7-.275l-5.6-5.6q-.75.6-1.725.95T9.5 16m0-2q1.875 0 3.188-1.312T14 9.5t-1.312-3.187T9.5 5T6.313 6.313T5 9.5t1.313 3.188T9.5 14"
14
+ }, null, -1)
11
15
  ]));
12
16
  }
13
- const i = /* @__PURE__ */ n(c, [["render", s]]);
17
+ const f = /* @__PURE__ */ n(c, [["render", s]]);
14
18
  export {
15
- i as default
19
+ f as default
16
20
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.312",
3
+ "version": "0.1.313",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",