adverich-kun-ui 0.1.462 → 0.1.464
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,43 +1,82 @@
|
|
|
1
|
-
import { reactive as
|
|
2
|
-
import { debounce as
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { reactive as I, ref as K, computed as f, unref as u, watch as R } from "vue";
|
|
2
|
+
import { debounce as j } from "../../../../utils/utils.js";
|
|
3
|
+
import { getValue as q, formatValue as x } from "../../../../utils/tableFormatters.js";
|
|
4
|
+
function E(b, d) {
|
|
5
|
+
const a = I({
|
|
5
6
|
search: "",
|
|
6
7
|
byColumn: {}
|
|
7
|
-
}), { items:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return
|
|
8
|
+
}), { items: y, customFilter: g, searchableKeys: C, headers: S } = b, F = K(!1), c = (e) => {
|
|
9
|
+
if (e == null) return "";
|
|
10
|
+
if (typeof e == "string") return e;
|
|
11
|
+
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
12
|
+
if (e instanceof Date) return e.toISOString();
|
|
13
|
+
if (typeof e == "object") {
|
|
14
|
+
if ("label" in e) return String(e.label);
|
|
15
|
+
if ("name" in e) return String(e.name);
|
|
16
|
+
try {
|
|
17
|
+
return String(e);
|
|
18
|
+
} catch {
|
|
19
|
+
return "";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
return String(e);
|
|
24
|
+
} catch {
|
|
25
|
+
return "";
|
|
17
26
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}, i
|
|
22
|
-
|
|
27
|
+
}, m = (e, r) => {
|
|
28
|
+
const t = c(e).toLowerCase(), n = c(r).toLowerCase();
|
|
29
|
+
return n ? t ? t.includes(n) : !1 : !0;
|
|
30
|
+
}, i = f(() => u(S) ?? []), h = f(() => {
|
|
31
|
+
const e = u(C);
|
|
32
|
+
return Array.isArray(e) && e.length ? e : i.value.map((r) => r == null ? void 0 : r.value).filter(Boolean);
|
|
33
|
+
}), w = (e, r) => {
|
|
34
|
+
const t = i.value.find((s) => (s == null ? void 0 : s.value) === r);
|
|
35
|
+
if (!t) return e == null ? void 0 : e[r];
|
|
36
|
+
const n = q(t, e), o = x(t, n);
|
|
37
|
+
return c(o);
|
|
38
|
+
}, p = (e, r, t) => {
|
|
39
|
+
const n = w(e, r), o = u(g);
|
|
40
|
+
if (typeof o == "function") {
|
|
41
|
+
const s = i.value.find((l) => (l == null ? void 0 : l.value) === r);
|
|
42
|
+
return o(e, r, t, s);
|
|
43
|
+
}
|
|
44
|
+
return Array.isArray(t) ? t.some((s) => m(n, s)) : m(n, t);
|
|
45
|
+
}, A = f(() => {
|
|
46
|
+
const e = u(y);
|
|
47
|
+
return Array.isArray(e) ? e.filter((r) => {
|
|
48
|
+
const t = a.search;
|
|
49
|
+
if (t && !h.value.some((s) => p(r, s, t)))
|
|
50
|
+
return !1;
|
|
51
|
+
for (const n in a.byColumn) {
|
|
52
|
+
const o = a.byColumn[n];
|
|
53
|
+
if (o != null && o !== "" && !p(r, n, o))
|
|
54
|
+
return !1;
|
|
55
|
+
}
|
|
56
|
+
return !0;
|
|
57
|
+
}) : [];
|
|
58
|
+
}), k = j((e) => {
|
|
59
|
+
a.search = c(e).toLowerCase();
|
|
60
|
+
}, u(d) ?? 150), V = (e, r) => {
|
|
61
|
+
a.byColumn[e] = r;
|
|
23
62
|
};
|
|
24
|
-
function
|
|
63
|
+
function L(e) {
|
|
25
64
|
for (const r in e)
|
|
26
|
-
|
|
65
|
+
V(r, e[r]);
|
|
27
66
|
}
|
|
28
|
-
const
|
|
29
|
-
|
|
67
|
+
const D = () => {
|
|
68
|
+
a.search = "", a.byColumn = {};
|
|
30
69
|
};
|
|
31
|
-
return
|
|
70
|
+
return R(() => u(y), () => {
|
|
32
71
|
}, { deep: !0 }), {
|
|
33
|
-
modalFilter:
|
|
34
|
-
appliedFilters:
|
|
35
|
-
filteredItems:
|
|
36
|
-
setSearch:
|
|
37
|
-
applyColumnFilters:
|
|
38
|
-
clearFilters:
|
|
72
|
+
modalFilter: F,
|
|
73
|
+
appliedFilters: a,
|
|
74
|
+
filteredItems: A,
|
|
75
|
+
setSearch: k,
|
|
76
|
+
applyColumnFilters: L,
|
|
77
|
+
clearFilters: D
|
|
39
78
|
};
|
|
40
79
|
}
|
|
41
80
|
export {
|
|
42
|
-
|
|
81
|
+
E as default
|
|
43
82
|
};
|