adverich-kun-ui 0.1.246 → 0.1.248

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