yahee-components 0.0.98-beta-01 → 0.0.98-beta-03
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,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as K, ref as v, computed as p, useSlots as S, provide as M, onMounted as O, onUnmounted as V, createElementBlock as i, openBlock as
|
|
1
|
+
import { defineComponent as K, ref as v, computed as p, useSlots as S, provide as M, onMounted as O, onUnmounted as V, createElementBlock as i, openBlock as h, createCommentVNode as y, renderSlot as I } from "vue";
|
|
2
2
|
import { filterContainerKey as $ } from "./key.js";
|
|
3
3
|
import g from "../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/debounce.js";
|
|
4
4
|
const x = { class: "yahee-filter-container" }, z = {
|
|
@@ -7,7 +7,8 @@ const x = { class: "yahee-filter-container" }, z = {
|
|
|
7
7
|
}, N = {
|
|
8
8
|
key: 1,
|
|
9
9
|
class: "search-section"
|
|
10
|
-
},
|
|
10
|
+
}, G = /* @__PURE__ */ K({
|
|
11
|
+
name: "YaheeFilterContainer",
|
|
11
12
|
__name: "filter-container",
|
|
12
13
|
props: {
|
|
13
14
|
debounceInterval: { default: 300 },
|
|
@@ -16,10 +17,10 @@ const x = { class: "yahee-filter-container" }, z = {
|
|
|
16
17
|
showSearchSection: { type: Boolean, default: !1 }
|
|
17
18
|
},
|
|
18
19
|
emits: ["change", "search"],
|
|
19
|
-
setup(_, { expose:
|
|
20
|
-
const n = _, c =
|
|
20
|
+
setup(_, { expose: C, emit: b }) {
|
|
21
|
+
const n = _, c = b, t = v({});
|
|
21
22
|
n.initialSearchItem && Object.keys(n.initialSearchItem).length > 0 && (t.value = { ...n.initialSearchItem });
|
|
22
|
-
const s = v(/* @__PURE__ */ new Map()), k = p(() => s.value.size > 0 || !!S().filters), A = p(() => n.showSearchSection || Array.from(s.value.values()).some((e) => e.type === "search") || !!S().search),
|
|
23
|
+
const s = v(/* @__PURE__ */ new Map()), k = p(() => s.value.size > 0 || !!S().filters), A = p(() => n.showSearchSection || Array.from(s.value.values()).some((e) => e.type === "search") || !!S().search), u = g((e) => {
|
|
23
24
|
c("change", e);
|
|
24
25
|
}, n.debounceInterval), m = g((e) => {
|
|
25
26
|
c("search", e);
|
|
@@ -29,14 +30,14 @@ const x = { class: "yahee-filter-container" }, z = {
|
|
|
29
30
|
s.value.delete(e);
|
|
30
31
|
}, d = (e) => {
|
|
31
32
|
const a = Array.isArray(e) ? e : [e], r = { ...t.value };
|
|
32
|
-
a.forEach((
|
|
33
|
-
const { filterKey: l, checkedValues: o } =
|
|
33
|
+
a.forEach((j) => {
|
|
34
|
+
const { filterKey: l, checkedValues: o } = j;
|
|
34
35
|
o.length === 0 || o[0] === "" || o[0] === null || o[0] === void 0 ? delete r[l] : o.length === 1 ? r[l] = o[0] : r[l] = o;
|
|
35
|
-
}), t.value = r,
|
|
36
|
+
}), t.value = r, u({ ...r });
|
|
36
37
|
}, B = (e) => {
|
|
37
38
|
const a = { ...t.value, ...e };
|
|
38
39
|
t.value = a, m({ ...a });
|
|
39
|
-
},
|
|
40
|
+
}, F = () => {
|
|
40
41
|
t.value = { ...n.initialSearchItem }, s.value.forEach((e) => {
|
|
41
42
|
e.methods.reset && e.methods.reset();
|
|
42
43
|
}), c("change", { ...t.value });
|
|
@@ -47,24 +48,24 @@ const x = { class: "yahee-filter-container" }, z = {
|
|
|
47
48
|
updateSearchItem: d,
|
|
48
49
|
handleSearch: B,
|
|
49
50
|
getCurrentSearchItem: f
|
|
50
|
-
}),
|
|
51
|
-
resetAllFilters:
|
|
51
|
+
}), C({
|
|
52
|
+
resetAllFilters: F,
|
|
52
53
|
getCurrentSearchItem: f,
|
|
53
54
|
updateSearchItem: d
|
|
54
55
|
}), O(() => {
|
|
55
56
|
n.immediate && Object.keys(t.value).length > 0 && c("change", { ...t.value });
|
|
56
57
|
}), V(() => {
|
|
57
|
-
|
|
58
|
-
}), (e, a) => (
|
|
59
|
-
k.value ? (
|
|
58
|
+
u.cancel(), m.cancel();
|
|
59
|
+
}), (e, a) => (h(), i("div", x, [
|
|
60
|
+
k.value ? (h(), i("div", z, [
|
|
60
61
|
I(e.$slots, "filters")
|
|
61
62
|
])) : y("", !0),
|
|
62
|
-
A.value ? (
|
|
63
|
+
A.value ? (h(), i("div", N, [
|
|
63
64
|
I(e.$slots, "search")
|
|
64
65
|
])) : y("", !0)
|
|
65
66
|
]));
|
|
66
67
|
}
|
|
67
68
|
});
|
|
68
69
|
export {
|
|
69
|
-
|
|
70
|
+
G as default
|
|
70
71
|
};
|