adverich-kun-ui 0.1.313 → 0.1.315

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