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