adverich-kun-ui 0.1.502 → 0.1.504

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,260 +1,277 @@
1
- import { mergeModels as Q, toRefs as Se, useModel as be, ref as v, watch as q, computed as G, onMounted as Ce, createElementBlock as r, openBlock as l, mergeProps as O, createCommentVNode as u, createElementVNode as j, renderSlot as a, createBlock as b, unref as s, normalizeClass as C, withCtx as x, createVNode as T, withDirectives as J, vModelText as Te, vShow as X, normalizeProps as d, guardReactiveProps as g, Fragment as Fe, createSlots as Y, renderList as Z, toDisplayString as $e, isRef as ke, nextTick as Pe } from "vue";
2
- import { isMobile as m } from "../../../../utils/_platform.js";
3
- import _ 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 Oe from "./KunTableFilter.vue.js";
12
- import je from "../composables/useExpand.js";
13
- import xe from "../composables/useOptions.js";
14
- import ze from "../composables/useSelect.js";
15
- import De from "../composables/useFilter.js";
16
- import He from "../composables/KunTableProps.js";
17
- const Ne = ["placeholder"], Ke = { class: "flex-1 overflow-auto bg-surface" }, Le = { key: 0 }, Ue = { key: 5 }, We = {
1
+ import { mergeModels as X, toRefs as Te, useModel as Fe, ref as C, watch as Y, computed as Z, onMounted as $e, createElementBlock as n, openBlock as l, mergeProps as z, createCommentVNode as a, createElementVNode as g, renderSlot as r, createBlock as T, unref as s, toDisplayString as D, withCtx as H, createVNode as F, normalizeClass as N, withDirectives as _, vModelText as Pe, vShow as ee, normalizeProps as d, guardReactiveProps as v, Fragment as Ae, createSlots as se, renderList as oe, isRef as Me, nextTick as xe } from "vue";
2
+ import { isMobile as f } from "../../../../utils/_platform.js";
3
+ import te from "../../../KunIcon/src/components/KunIcon.vue.js";
4
+ import Ie from "../../../../icons/IconFilter.vue.js";
5
+ import Re from "../../../../icons/IconSearch.vue.js";
6
+ import Ee from "./KunTableHeaders.vue.js";
7
+ import Be from "./KunTableFooter.vue.js";
8
+ import Ve from "./KunTableRows.vue.js";
9
+ import Oe from "./KunTableIterators.vue.js";
10
+ import ze from "../../../KunBtn/src/components/KunBtn.vue.js";
11
+ import De from "./KunTableFilter.vue.js";
12
+ import He from "../composables/useExpand.js";
13
+ import Ne from "../composables/useOptions.js";
14
+ import je from "../composables/useSelect.js";
15
+ import Ke from "../composables/useFilter.js";
16
+ import Le from "../composables/KunTableProps.js";
17
+ const Ue = {
18
+ key: 0,
19
+ class: "p-2 bg-surface print:hidden flex w-full justify-between"
20
+ }, We = { class: "w-fit flex items-center" }, Qe = {
21
+ key: 0,
22
+ class: "flex items-center justify-center"
23
+ }, qe = { class: "pr-2" }, Ge = { class: "flex h-full items-center" }, Je = ["placeholder"], Xe = { class: "flex-1 overflow-auto bg-surface" }, Ye = { key: 0 }, Ze = { key: 5 }, _e = {
18
24
  key: 1,
19
25
  class: "h-full flex justify-center items-center"
20
- }, Qe = { class: "text-center text-4xl" }, qe = {
26
+ }, es = { class: "text-center text-4xl" }, ss = {
21
27
  key: 1,
22
28
  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", ms = {
29
+ }, os = "overflow-hidden h-full w-full flex flex-col border border-slate-200 dark:border-slate-800 rounded", ts = "table-auto w-full h-fit text-sm text-left", Ss = {
24
30
  __name: "KunTable",
25
- props: /* @__PURE__ */ Q(He(), {
31
+ props: /* @__PURE__ */ X(Le(), {
26
32
  selectedItems: { type: Array, default: () => [] },
27
33
  selectedItemsModifiers: {}
28
34
  }),
29
- emits: /* @__PURE__ */ Q(["update:page", "update:itemsPerPage", "update:sortBy", "update:search", "focusOnSearch"], ["update:selectedItems"]),
30
- setup(z, { emit: ee }) {
31
- const S = ee, p = z, F = Se(p), se = be(z, "selectedItems"), {
32
- headers: D,
33
- showExpand: $,
34
- showSelect: k,
35
- rowClass: H,
36
- hideDefaultFooter: oe,
37
- hideDefaultHeader: te,
38
- tableClass: le,
39
- wrapperClass: ae,
40
- pageOptions: ne,
41
- items: Xe,
42
- searchable: N,
43
- debounceTime: re
44
- } = F, w = v(p.search);
45
- q(() => p.search, (e) => {
46
- e !== w.value && (w.value = e);
35
+ emits: /* @__PURE__ */ X(["update:page", "update:itemsPerPage", "update:sortBy", "update:search", "focusOnSearch"], ["update:selectedItems"]),
36
+ setup(j, { emit: le }) {
37
+ const k = le, p = j, $ = Te(p), w = Fe(j, "selectedItems"), {
38
+ headers: K,
39
+ showExpand: P,
40
+ showSelect: A,
41
+ rowClass: L,
42
+ hideDefaultFooter: ne,
43
+ hideDefaultHeader: ae,
44
+ tableClass: re,
45
+ wrapperClass: ie,
46
+ pageOptions: ce,
47
+ items: ls,
48
+ searchable: U,
49
+ debounceTime: ue
50
+ } = $, y = C(p.search);
51
+ Y(() => p.search, (e) => {
52
+ e !== y.value && (y.value = e);
47
53
  });
48
- const P = G(() => p.headers.map((e) => {
49
- var t, c;
54
+ const M = Z(() => p.headers.map((e) => {
55
+ var t, u;
50
56
  const o = { ...e };
51
57
  if ((e.columnType === "function" || e.columnType == "objectFunction" || e.columnType == "simpleFunction") && typeof e.columnFunction == "string") {
52
- const n = (t = p.functionMap) == null ? void 0 : t[e.columnFunction];
53
- typeof n == "function" ? o.columnFunction = n : (console.warn(
58
+ const i = (t = p.functionMap) == null ? void 0 : t[e.columnFunction];
59
+ typeof i == "function" ? o.columnFunction = i : (console.warn(
54
60
  `[KunTable] No se encontró la función "${e.columnFunction}" en functionMap`
55
61
  ), o.columnFunction = () => "");
56
62
  }
57
63
  if (e.columnFormat === "function" && typeof e.columnRowText == "string") {
58
- const n = (c = p.functionMap) == null ? void 0 : c[e.columnRowText];
59
- typeof n == "function" ? o.columnRowText = n : (console.warn(
64
+ const i = (u = p.functionMap) == null ? void 0 : u[e.columnRowText];
65
+ typeof i == "function" ? o.columnRowText = i : (console.warn(
60
66
  `[KunTable] No se encontró la función "${e.columnRowText}" en functionMap`
61
67
  ), o.columnRowText = () => "");
62
68
  }
63
69
  return o;
64
- })), { filteredItems: K, setSearch: ie, modalFilter: y, applyColumnFilters: ce, clearFilters: ue, appliedFilters: de } = De(F, re, P);
65
- q(w, (e) => {
66
- S("update:search", e), ie(e);
70
+ })), { filteredItems: b, setSearch: de, modalFilter: S, applyColumnFilters: pe, clearFilters: me, appliedFilters: fe } = Ke($, ue, M);
71
+ Y(y, (e) => {
72
+ k("update:search", e), de(e);
67
73
  });
68
- const { options: i, paginatedItems: f, updateSort: pe } = xe(F, S, K), { isSelected: M, toggleSelect: A, toggleSelectAll: me, allSelected: fe, someSelected: he } = ze(f, se), { isExpanded: I, toggleExpand: R } = je(), h = G(() => ({
69
- items: f.value,
70
- headers: D.value,
71
- page: i.page,
72
- itemsPerPage: i.itemsPerPage,
73
- toggleSelect: A,
74
- isSelected: M,
75
- toggleExpand: R,
76
- isExpanded: I,
77
- sortBy: i.sortBy,
74
+ const { options: c, paginatedItems: m, updateSort: he } = Ne($, k, b), { isSelected: x, toggleSelect: I, toggleSelectAll: ge, allSelected: ve, someSelected: we, moreThanPaginated: ye, clearSelection: W, selectCompleteAll: Q } = je(m, w, b), { isExpanded: R, toggleExpand: E } = He(), h = Z(() => ({
75
+ items: m.value,
76
+ headers: K.value,
77
+ page: c.page,
78
+ itemsPerPage: c.itemsPerPage,
79
+ toggleSelect: I,
80
+ isSelected: x,
81
+ toggleExpand: E,
82
+ isExpanded: R,
83
+ sortBy: c.sortBy,
78
84
  hasActions: p.hasActions
79
- })), ge = [Ge, ae.value], we = [Je, le.value];
80
- Ce(() => U());
81
- const L = v(null), E = v(!0), B = v(!1);
82
- function ye() {
83
- ve();
85
+ })), be = [os, ie.value], Se = [ts, re.value];
86
+ $e(() => G());
87
+ const q = C(null), B = C(!0), V = C(!1);
88
+ function Ce() {
89
+ ke();
84
90
  }
85
- function ve() {
86
- m.value && (W(), Pe(() => {
87
- L.value.focus();
91
+ function ke() {
92
+ f.value && (J(), xe(() => {
93
+ q.value.focus();
88
94
  }));
89
95
  }
90
- function U() {
91
- m.value && (V.value = "w-fit", E.value = !1, B.value = !0, S("focusOnSearch", !1));
96
+ function G() {
97
+ f.value && (O.value = "w-fit", B.value = !1, V.value = !0, k("focusOnSearch", !1));
92
98
  }
93
- function W() {
94
- m.value && (V.value = "w-full border", B.value = !1, E.value = !0, S("focusOnSearch", !0));
99
+ function J() {
100
+ f.value && (O.value = "w-full border", V.value = !1, B.value = !0, k("focusOnSearch", !0));
95
101
  }
96
- const V = v("w-full border max-w-sm");
97
- return (e, o) => (l(), r("div", O({ class: ge }, e.$attrs, { style: { "user-select": "text" } }), [
98
- s(N) || e.filterable || e.$slots.prependSearch || e.$slots.appendSearch ? (l(), r("div", {
99
- key: 0,
100
- class: C(["p-2 bg-surface print:hidden", {
101
- "justify-start flex": e.searchPosition === "start",
102
- "justify-center flex": e.searchPosition === "center",
103
- "justify-end flex": e.searchPosition === "end"
104
- }])
105
- }, [
106
- a(e.$slots, "prependSearch"),
107
- e.filterable && e.filters.length ? (l(), b(Ve, {
108
- key: 0,
109
- class: "h-fit",
110
- onClick: o[0] || (o[0] = (t) => y.value = !0),
111
- rounded: "rounded-full",
112
- size: "xs",
113
- bgColor: "bg-green-200 dark:bg-green-800"
114
- }, {
115
- default: x(() => [
116
- T(_, {
117
- class: "h-fit",
118
- icon: Me,
119
- size: "text-lg"
120
- })
121
- ]),
122
- _: 1
123
- })) : u("", !0),
124
- s(N) ? (l(), r("div", {
125
- key: 1,
126
- class: C(["rounded flex mx-2", [V.value]])
127
- }, [
128
- J(j("input", {
129
- "onUpdate:modelValue": o[1] || (o[1] = (t) => w.value = t),
130
- type: "text",
131
- placeholder: e.searchPlaceholder,
132
- class: C(["w-full text-sm", s(m) ? "px-1" : "px-2 py-1"]),
133
- ref_key: "searchRef",
134
- ref: L,
135
- onFocus: W,
136
- onBlur: U
137
- }, null, 42, Ne), [
138
- [Te, w.value],
139
- [X, E.value]
140
- ]),
141
- J(T(_, {
142
- icon: Ae,
143
- onClick: ye
144
- }, null, 512), [
145
- [X, B.value]
146
- ])
147
- ], 2)) : u("", !0),
148
- a(e.$slots, "appendSearch")
149
- ], 2)) : u("", !0),
150
- j("div", Ke, [
151
- s(f).length ? (l(), r("table", {
102
+ const O = C("w-full border max-w-sm");
103
+ return (e, o) => (l(), n("div", z({ class: be }, e.$attrs, { style: { "user-select": "text" } }), [
104
+ s(U) || e.filterable || e.$slots.prependSearch || e.$slots.appendSearch ? (l(), n("div", Ue, [
105
+ g("div", We, [
106
+ r(e.$slots, "prependSearch")
107
+ ]),
108
+ w.value.length ? (l(), n("div", Qe, [
109
+ g("span", qe, "Se han seleccionado " + D(w.value.length) + " registros.", 1),
110
+ s(m).length === w.value.length ? (l(), n("span", {
111
+ key: 0,
112
+ class: "bg-secondary hover:!bg-blue-500 rounded cursor-pointer px-2",
113
+ onClick: o[0] || (o[0] = (...t) => s(Q) && s(Q)(...t))
114
+ }, "Seleccionar todos los " + D(s(b).length) + " registros", 1)) : a("", !0),
115
+ s(b).length === w.value.length ? (l(), n("span", {
116
+ key: 1,
117
+ class: "bg-secondary hover:!bg-blue-500 rounded cursor-pointer px-2",
118
+ onClick: o[1] || (o[1] = (...t) => s(W) && s(W)(...t))
119
+ }, "Anular selección")) : a("", !0)
120
+ ])) : a("", !0),
121
+ g("div", Ge, [
122
+ e.filterable && e.filters.length ? (l(), T(ze, {
123
+ key: 0,
124
+ class: "h-fit",
125
+ onClick: o[2] || (o[2] = (t) => S.value = !0),
126
+ rounded: "rounded-full",
127
+ size: "xs",
128
+ bgColor: "bg-green-200 dark:bg-green-800"
129
+ }, {
130
+ default: H(() => [
131
+ F(te, {
132
+ class: "h-fit",
133
+ icon: Ie,
134
+ size: "text-lg"
135
+ })
136
+ ]),
137
+ _: 1
138
+ })) : a("", !0),
139
+ s(U) ? (l(), n("div", {
140
+ key: 1,
141
+ class: N(["rounded flex mx-2", [O.value]])
142
+ }, [
143
+ _(g("input", {
144
+ "onUpdate:modelValue": o[3] || (o[3] = (t) => y.value = t),
145
+ type: "text",
146
+ placeholder: e.searchPlaceholder,
147
+ class: N(["w-full text-sm", s(f) ? "px-1" : "px-2 py-1"]),
148
+ ref_key: "searchRef",
149
+ ref: q,
150
+ onFocus: J,
151
+ onBlur: G
152
+ }, null, 42, Je), [
153
+ [Pe, y.value],
154
+ [ee, B.value]
155
+ ]),
156
+ _(F(te, {
157
+ icon: Re,
158
+ onClick: Ce
159
+ }, null, 512), [
160
+ [ee, V.value]
161
+ ])
162
+ ], 2)) : a("", !0),
163
+ r(e.$slots, "appendSearch")
164
+ ])
165
+ ])) : a("", !0),
166
+ g("div", Xe, [
167
+ s(m).length ? (l(), n("table", {
152
168
  key: 0,
153
- class: C(we)
169
+ class: N(Se)
154
170
  }, [
155
- e.$slots.colgroup && !s(m) ? (l(), r("colgroup", Le, [
156
- a(e.$slots, "colgroup", d(g(h.value)))
157
- ])) : u("", !0),
158
- !s(te) && !s(m) ? (l(), b(Ie, {
171
+ e.$slots.colgroup && !s(f) ? (l(), n("colgroup", Ye, [
172
+ r(e.$slots, "colgroup", d(v(h.value)))
173
+ ])) : a("", !0),
174
+ !s(ae) && !s(f) ? (l(), T(Ee, {
159
175
  key: 1,
160
- headers: s(D),
161
- "sort-by": s(i).sortBy,
162
- "show-select": s(k),
163
- "show-expand": s($),
164
- "all-selected": s(fe),
165
- "some-selected": s(he),
176
+ headers: s(K),
177
+ "sort-by": s(c).sortBy,
178
+ "show-select": s(A),
179
+ "show-expand": s(P),
180
+ "all-selected": s(ve),
181
+ "more-than-paginated": s(ye),
182
+ "some-selected": s(we),
166
183
  "thead-class": e.theadClass,
167
184
  "tr-class": e.trClass,
168
185
  "th-class": e.thClass,
169
186
  "has-actions": e.hasActions,
170
187
  "action-label": e.actionLabel,
171
- onSort: s(pe),
172
- onToggleSelectAll: s(me),
188
+ onSort: s(he),
189
+ onToggleSelectAll: s(ge),
173
190
  customHeaders: e.customSlots
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(O({ key: 2 }, h.value))),
175
- s(m) ? (l(), b(Be, {
191
+ }, null, 8, ["headers", "sort-by", "show-select", "show-expand", "all-selected", "more-than-paginated", "some-selected", "thead-class", "tr-class", "th-class", "has-actions", "action-label", "onSort", "onToggleSelectAll", "customHeaders"])) : r(e.$slots, "thead", d(z({ key: 2 }, h.value))),
192
+ s(f) ? (l(), T(Oe, {
176
193
  key: 4,
177
- items: s(f),
178
- headers: P.value,
179
- "row-class": s(H),
194
+ items: s(m),
195
+ headers: M.value,
196
+ "row-class": s(L),
180
197
  "row-class-condition": e.rowClassCondition,
181
- "is-selected": s(M),
182
- "is-expanded": s(I),
183
- "show-select": s(k),
184
- "show-expand": s($),
198
+ "is-selected": s(x),
199
+ "is-expanded": s(R),
200
+ "show-select": s(A),
201
+ "show-expand": s(P),
185
202
  "has-actions": e.hasActions,
186
203
  "action-loading-map": e.actionLoadingMap,
187
- onToggleExpand: s(R),
188
- onToggleSelect: s(A),
204
+ onToggleExpand: s(E),
205
+ onToggleSelect: s(I),
189
206
  customSlots: e.customSlots
190
- }, Y({ _: 2 }, [
191
- Z(e.$slots, (t, c) => ({
192
- name: c,
193
- fn: x((n) => [
194
- a(e.$slots, c, d(g(n)))
207
+ }, se({ _: 2 }, [
208
+ oe(e.$slots, (t, u) => ({
209
+ name: u,
210
+ fn: H((i) => [
211
+ r(e.$slots, u, d(v(i)))
195
212
  ])
196
213
  }))
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(Fe, { key: 3 }, [
198
- a(e.$slots, "body.prepend", d(g(h.value))),
199
- T(Ee, {
200
- items: s(f),
201
- headers: P.value,
214
+ ]), 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(), n(Ae, { key: 3 }, [
215
+ r(e.$slots, "body.prepend", d(v(h.value))),
216
+ F(Ve, {
217
+ items: s(m),
218
+ headers: M.value,
202
219
  "tbody-class": e.tbodyClass,
203
- "row-class": s(H),
220
+ "row-class": s(L),
204
221
  "row-class-condition": e.rowClassCondition,
205
222
  "tr-class": e.trClass,
206
223
  "td-class": e.tdClass,
207
224
  "selected-class": e.selectedClass,
208
225
  "striped-class": e.stripedClass,
209
- "is-selected": s(M),
210
- "is-expanded": s(I),
211
- "show-select": s(k),
212
- "show-expand": s($),
226
+ "is-selected": s(x),
227
+ "is-expanded": s(R),
228
+ "show-select": s(A),
229
+ "show-expand": s(P),
213
230
  "has-actions": e.hasActions,
214
231
  "action-loading-map": e.actionLoadingMap,
215
- onToggleExpand: s(R),
216
- onToggleSelect: s(A),
232
+ onToggleExpand: s(E),
233
+ onToggleSelect: s(I),
217
234
  customSlots: e.customSlots
218
- }, Y({ _: 2 }, [
219
- Z(e.$slots, (t, c) => ({
220
- name: c,
221
- fn: x((n) => [
222
- a(e.$slots, c, d(g(n)))
235
+ }, se({ _: 2 }, [
236
+ oe(e.$slots, (t, u) => ({
237
+ name: u,
238
+ fn: H((i) => [
239
+ r(e.$slots, u, d(v(i)))
223
240
  ])
224
241
  }))
225
242
  ]), 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"]),
226
- a(e.$slots, "body.append", d(g(h.value)))
243
+ r(e.$slots, "body.append", d(v(h.value)))
227
244
  ], 64)),
228
- e.$slots.tfoot ? (l(), r("tfoot", Ue, [
229
- a(e.$slots, "tfoot", d(g(h.value)))
230
- ])) : u("", !0)
231
- ])) : u("", !0),
232
- s(f).length ? u("", !0) : (l(), r("div", We, [
233
- j("div", Qe, $e(e.noDataText), 1)
245
+ e.$slots.tfoot ? (l(), n("tfoot", Ze, [
246
+ r(e.$slots, "tfoot", d(v(h.value)))
247
+ ])) : a("", !0)
248
+ ])) : a("", !0),
249
+ s(m).length ? a("", !0) : (l(), n("div", _e, [
250
+ g("div", es, D(e.noDataText), 1)
234
251
  ]))
235
252
  ]),
236
- s(oe) ? a(e.$slots, "footer", d(O({ key: 2 }, h.value))) : (l(), r("div", qe, [
237
- T(Re, {
238
- "items-length": s(K).length,
239
- "items-per-page": s(i).itemsPerPage,
240
- "current-page": s(i).page,
241
- "page-options": s(ne),
242
- "onUpdate:itemsPerPage": o[2] || (o[2] = (t) => s(i).itemsPerPage = t),
243
- "onUpdate:page": o[3] || (o[3] = (t) => s(i).page = t)
253
+ s(ne) ? r(e.$slots, "footer", d(z({ key: 2 }, h.value))) : (l(), n("div", ss, [
254
+ F(Be, {
255
+ "items-length": s(b).length,
256
+ "items-per-page": s(c).itemsPerPage,
257
+ "current-page": s(c).page,
258
+ "page-options": s(ce),
259
+ "onUpdate:itemsPerPage": o[4] || (o[4] = (t) => s(c).itemsPerPage = t),
260
+ "onUpdate:page": o[5] || (o[5] = (t) => s(c).page = t)
244
261
  }, null, 8, ["items-length", "items-per-page", "current-page", "page-options"])
245
262
  ])),
246
- e.filterable && s(y) ? (l(), b(Oe, {
263
+ e.filterable && s(S) ? (l(), T(De, {
247
264
  key: 3,
248
265
  filters: e.filters,
249
- modelValue: s(y),
250
- "onUpdate:modelValue": o[4] || (o[4] = (t) => ke(y) ? y.value = t : null),
251
- onApplyFilters: s(ce),
252
- onClearFilters: s(ue),
253
- activeFilters: s(de).byColumn
254
- }, null, 8, ["filters", "modelValue", "onApplyFilters", "onClearFilters", "activeFilters"])) : u("", !0)
266
+ modelValue: s(S),
267
+ "onUpdate:modelValue": o[6] || (o[6] = (t) => Me(S) ? S.value = t : null),
268
+ onApplyFilters: s(pe),
269
+ onClearFilters: s(me),
270
+ activeFilters: s(fe).byColumn
271
+ }, null, 8, ["filters", "modelValue", "onApplyFilters", "onClearFilters", "activeFilters"])) : a("", !0)
255
272
  ], 16));
256
273
  }
257
274
  };
258
275
  export {
259
- ms as default
276
+ Ss as default
260
277
  };
@@ -1,12 +1,12 @@
1
- import { computed as k, ref as b, onMounted as g, createBlock as x, createCommentVNode as C, openBlock as d, withCtx as l, createElementVNode as c, createVNode as o, createElementBlock as $, Fragment as N, renderList as h, createTextVNode as V } from "vue";
1
+ import { computed as g, ref as k, onMounted as b, watch as C, createBlock as x, createCommentVNode as $, openBlock as d, withCtx as o, createElementVNode as c, createVNode as a, createElementBlock as h, Fragment as N, renderList as w, createTextVNode as V } from "vue";
2
2
  import z from "../../../KunDialog/src/components/KunDialog.vue.js";
3
- import B from "../../../KunRow/src/components/KunRow.vue.js";
4
- import j from "../../../KunCol/src/components/KunCol.vue.js";
5
- import w from "../../../KunAutocomplete/src/components/KunAutocomplete.vue.js";
3
+ import A from "../../../KunRow/src/components/KunRow.vue.js";
4
+ import B from "../../../KunCol/src/components/KunCol.vue.js";
5
+ import j from "../../../KunAutocomplete/src/components/KunAutocomplete.vue.js";
6
6
  import p from "../../../KunBtn/src/components/KunBtn.vue.js";
7
7
  import T from "../../../KunIcon/src/components/KunIcon.vue.js";
8
8
  import U from "../../../../icons/IconClose.vue.js";
9
- const A = { class: "w-full" }, D = { class: "flex justify-end px-1" }, E = { class: "flex justify-end mt-8 p-2 gap-x-2" }, q = {
9
+ const D = { class: "w-full" }, E = { class: "flex justify-end px-1" }, I = { class: "flex justify-end mt-8 p-2 gap-x-2" }, G = {
10
10
  __name: "KunTableFilter",
11
11
  props: {
12
12
  modelValue: Boolean,
@@ -15,44 +15,47 @@ const A = { class: "w-full" }, D = { class: "flex justify-end px-1" }, E = { cla
15
15
  },
16
16
  emits: ["update:modelValue", "applyFilters", "clearFilters"],
17
17
  setup(f, { emit: v }) {
18
- const n = f, i = v, m = k({
18
+ const n = f, r = v, m = g({
19
19
  get: () => n.modelValue,
20
- set: (a) => i("update:modelValue", a)
21
- }), s = b({});
22
- g(() => {
23
- s.value = { ...n.filters.reduce((a, t) => {
20
+ set: (l) => r("update:modelValue", l)
21
+ }), i = k({});
22
+ b(() => {
23
+ i.value = { ...n.filters.reduce((l, t) => {
24
24
  var _;
25
- const e = t.key, r = (_ = n.activeFilters) == null ? void 0 : _[e];
26
- return r !== void 0 && (a[e] = r), a;
25
+ const e = t.value, s = (_ = n.activeFilters) == null ? void 0 : _[e];
26
+ return s !== void 0 && (l[e] = s), l;
27
27
  }, {}) };
28
28
  });
29
- function F() {
30
- i("applyFilters", s.value), u();
31
- }
32
29
  function y() {
33
- i("clearFilters"), u();
30
+ r("applyFilters", i.value), u();
31
+ }
32
+ function F() {
33
+ r("clearFilters"), u();
34
34
  }
35
35
  function u() {
36
- i("update:modelValue", !1);
36
+ r("update:modelValue", !1);
37
37
  }
38
- return (a, t) => m.value ? (d(), x(z, {
38
+ return C(i, (l) => {
39
+ for (const t in l)
40
+ Array.isArray(l[t]) && l[t].length === 0 && delete l[t];
41
+ }, { deep: !0 }), (l, t) => m.value ? (d(), x(z, {
39
42
  key: 0,
40
43
  modelValue: m.value,
41
44
  "onUpdate:modelValue": t[0] || (t[0] = (e) => m.value = e),
42
45
  yPosition: "top",
43
46
  maxWidth: "max-w-1/2"
44
47
  }, {
45
- default: l(() => [
46
- c("div", A, [
47
- c("div", D, [
48
- o(p, {
48
+ default: o(() => [
49
+ c("div", D, [
50
+ c("div", E, [
51
+ a(p, {
49
52
  onClick: u,
50
53
  rounded: "rounded-full",
51
54
  size: "xxs",
52
55
  bgColor: "bg-transparent"
53
56
  }, {
54
- default: l(() => [
55
- o(T, {
57
+ default: o(() => [
58
+ a(T, {
56
59
  color: "text-red-500",
57
60
  icon: U,
58
61
  size: "text-lg"
@@ -61,17 +64,17 @@ const A = { class: "w-full" }, D = { class: "flex justify-end px-1" }, E = { cla
61
64
  _: 1
62
65
  })
63
66
  ]),
64
- o(B, null, {
65
- default: l(() => [
66
- (d(!0), $(N, null, h(f.filters, (e) => (d(), x(j, {
67
+ a(A, null, {
68
+ default: o(() => [
69
+ (d(!0), h(N, null, w(f.filters, (e) => (d(), x(B, {
67
70
  cols: "4",
68
71
  class: "px-2"
69
72
  }, {
70
- default: l(() => [
71
- o(w, {
73
+ default: o(() => [
74
+ a(j, {
72
75
  multiple: "",
73
- modelValue: s.value[e.value],
74
- "onUpdate:modelValue": (r) => s.value[e.value] = r,
76
+ modelValue: i.value[e.value],
77
+ "onUpdate:modelValue": (s) => i.value[e.value] = s,
75
78
  items: e.items,
76
79
  "z-index": "z-250",
77
80
  "item-value": "id",
@@ -87,16 +90,16 @@ const A = { class: "w-full" }, D = { class: "flex justify-end px-1" }, E = { cla
87
90
  ]),
88
91
  _: 1
89
92
  }),
90
- c("div", E, [
91
- o(p, { onClick: y }, {
92
- default: l(() => t[1] || (t[1] = [
93
+ c("div", I, [
94
+ a(p, { onClick: F }, {
95
+ default: o(() => t[1] || (t[1] = [
93
96
  V(" Limpiar filtros ")
94
97
  ])),
95
98
  _: 1,
96
99
  __: [1]
97
100
  }),
98
- o(p, { onClick: F }, {
99
- default: l(() => t[2] || (t[2] = [
101
+ a(p, { onClick: y }, {
102
+ default: o(() => t[2] || (t[2] = [
100
103
  V(" Aplicar ")
101
104
  ])),
102
105
  _: 1,
@@ -106,9 +109,9 @@ const A = { class: "w-full" }, D = { class: "flex justify-end px-1" }, E = { cla
106
109
  ])
107
110
  ]),
108
111
  _: 1
109
- }, 8, ["modelValue"])) : C("", !0);
112
+ }, 8, ["modelValue"])) : $("", !0);
110
113
  }
111
114
  };
112
115
  export {
113
- q as default
116
+ G as default
114
117
  };