adverich-kun-ui 0.1.389 → 0.1.390

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