@ulu/frontend-vue 0.2.0-beta.11 → 0.2.0-beta.13
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/components/collapsible/UluAccordionGroup.vue.d.ts +2 -2
- package/dist/components/collapsible/UluAccordionGroup.vue.d.ts.map +1 -1
- package/dist/components/collapsible/UluAccordionGroup.vue.js +22 -19
- package/dist/components/elements/UluBadgeStack.vue.d.ts +1 -1
- package/dist/components/elements/UluBadgeStack.vue.d.ts.map +1 -1
- package/dist/components/elements/UluBadgeStack.vue.js +12 -9
- package/dist/components/elements/UluDefinitionList.vue.d.ts +2 -2
- package/dist/components/elements/UluDefinitionList.vue.d.ts.map +1 -1
- package/dist/components/elements/UluDefinitionList.vue.js +8 -7
- package/dist/components/elements/UluList.vue.d.ts.map +1 -1
- package/dist/components/elements/UluList.vue.js +14 -13
- package/dist/components/navigation/UluMenu.vue.d.ts.map +1 -1
- package/dist/components/navigation/UluMenuStack.vue.d.ts.map +1 -1
- package/dist/components/navigation/UluMenuStack.vue.js +17 -16
- package/dist/components/navigation/UluNavStrip.vue.d.ts.map +1 -1
- package/dist/components/navigation/UluNavStrip.vue.js +9 -8
- package/dist/components/systems/facets/useFacets.d.ts +3 -0
- package/dist/components/systems/facets/useFacets.d.ts.map +1 -1
- package/dist/components/systems/facets/useFacets.js +124 -112
- package/lib/components/collapsible/UluAccordionGroup.vue +4 -1
- package/lib/components/elements/UluBadgeStack.vue +4 -1
- package/lib/components/elements/UluDefinitionList.vue +5 -1
- package/lib/components/elements/UluList.vue +1 -0
- package/lib/components/navigation/UluMenu.vue +4 -1
- package/lib/components/navigation/UluMenuStack.vue +1 -0
- package/lib/components/navigation/UluNavStrip.vue +1 -0
- package/lib/components/systems/facets/useFacets.js +33 -17
- package/package.json +3 -2
|
@@ -14,7 +14,7 @@ declare const __VLS_component: import('vue').DefineComponent<{}, {
|
|
|
14
14
|
readonly items?: unknown[] | undefined;
|
|
15
15
|
readonly modifiers?: string | unknown[] | undefined;
|
|
16
16
|
};
|
|
17
|
-
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {},
|
|
17
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
18
18
|
type __VLS_TemplateResult = {
|
|
19
19
|
attrs: Partial<{}>;
|
|
20
20
|
slots: {
|
|
@@ -36,6 +36,6 @@ type __VLS_TemplateResult = {
|
|
|
36
36
|
}): any;
|
|
37
37
|
};
|
|
38
38
|
refs: {};
|
|
39
|
-
rootEl:
|
|
39
|
+
rootEl: any;
|
|
40
40
|
};
|
|
41
41
|
//# sourceMappingURL=UluAccordionGroup.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UluAccordionGroup.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/collapsible/UluAccordionGroup.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UluAccordionGroup.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/collapsible/UluAccordionGroup.vue"],"names":[],"mappings":"AAgCA;wBAkRqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAVjC;;;;;;;;;;;2OAOG"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { ref as f, watch as p, createElementBlock as g, openBlock as
|
|
2
|
-
import
|
|
3
|
-
const
|
|
1
|
+
import { ref as f, watch as p, createElementBlock as g, createCommentVNode as y, openBlock as s, Fragment as O, renderList as h, createBlock as k, createSlots as v, withCtx as l, renderSlot as m, createTextVNode as $, toDisplayString as S } from "vue";
|
|
2
|
+
import B from "./UluAccordion.vue.js";
|
|
3
|
+
const E = {
|
|
4
|
+
key: 0,
|
|
5
|
+
class: "accordion-group"
|
|
6
|
+
}, x = {
|
|
4
7
|
__name: "UluAccordionGroup",
|
|
5
8
|
props: {
|
|
6
9
|
/**
|
|
@@ -33,30 +36,30 @@ const B = { class: "accordion-group" }, x = {
|
|
|
33
36
|
default: !0
|
|
34
37
|
}
|
|
35
38
|
},
|
|
36
|
-
setup(
|
|
37
|
-
const u =
|
|
39
|
+
setup(a) {
|
|
40
|
+
const u = a, o = f([]);
|
|
38
41
|
p(() => u.items, (e) => {
|
|
39
|
-
|
|
40
|
-
...
|
|
41
|
-
isOpen:
|
|
42
|
+
o.value = e.map((i) => ({
|
|
43
|
+
...i,
|
|
44
|
+
isOpen: i.isOpen || !1
|
|
42
45
|
}));
|
|
43
46
|
}, { immediate: !0, deep: !0 });
|
|
44
|
-
function c(e,
|
|
45
|
-
|
|
47
|
+
function c(e, i) {
|
|
48
|
+
i ? o.value.forEach((t, r) => {
|
|
46
49
|
t.isOpen = r === e;
|
|
47
|
-
}) :
|
|
50
|
+
}) : o.value[e].isOpen = !1;
|
|
48
51
|
}
|
|
49
|
-
return (e,
|
|
50
|
-
(
|
|
52
|
+
return (e, i) => a.items?.length ? (s(), g("div", E, [
|
|
53
|
+
(s(!0), g(O, null, h(o.value, (t, r) => (s(), k(B, {
|
|
51
54
|
key: r,
|
|
52
55
|
"model-value": t.isOpen,
|
|
53
56
|
"onUpdate:modelValue": (n) => c(r, n),
|
|
54
57
|
"trigger-text": t.title,
|
|
55
58
|
classes: t.classes,
|
|
56
|
-
"trigger-text-element":
|
|
57
|
-
modifiers:
|
|
58
|
-
animate:
|
|
59
|
-
},
|
|
59
|
+
"trigger-text-element": a.triggerTextElement,
|
|
60
|
+
modifiers: a.modifiers,
|
|
61
|
+
animate: a.animate
|
|
62
|
+
}, v({
|
|
60
63
|
default: l(({ isOpen: n, toggle: d }) => [
|
|
61
64
|
m(e.$slots, "item", {
|
|
62
65
|
item: t,
|
|
@@ -64,7 +67,7 @@ const B = { class: "accordion-group" }, x = {
|
|
|
64
67
|
isOpen: n,
|
|
65
68
|
toggle: d
|
|
66
69
|
}, () => [
|
|
67
|
-
|
|
70
|
+
$(S(t.content), 1)
|
|
68
71
|
])
|
|
69
72
|
]),
|
|
70
73
|
_: 2
|
|
@@ -92,7 +95,7 @@ const B = { class: "accordion-group" }, x = {
|
|
|
92
95
|
key: "1"
|
|
93
96
|
} : void 0
|
|
94
97
|
]), 1032, ["model-value", "onUpdate:modelValue", "trigger-text", "classes", "trigger-text-element", "modifiers", "animate"]))), 128))
|
|
95
|
-
]));
|
|
98
|
+
])) : y("", !0);
|
|
96
99
|
}
|
|
97
100
|
};
|
|
98
101
|
export {
|
|
@@ -3,6 +3,6 @@ declare const _default: import('vue').DefineComponent<{}, {
|
|
|
3
3
|
$props: {
|
|
4
4
|
readonly items?: unknown[] | undefined;
|
|
5
5
|
};
|
|
6
|
-
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {},
|
|
6
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
7
7
|
export default _default;
|
|
8
8
|
//# sourceMappingURL=UluBadgeStack.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UluBadgeStack.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/elements/UluBadgeStack.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UluBadgeStack.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/elements/UluBadgeStack.vue"],"names":[],"mappings":"AAcA;"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { createElementBlock as e, openBlock as
|
|
2
|
-
import
|
|
3
|
-
const
|
|
1
|
+
import { createElementBlock as e, createCommentVNode as c, openBlock as t, Fragment as m, renderList as n, createVNode as o, mergeProps as l } from "vue";
|
|
2
|
+
import u from "./UluBadge.vue.js";
|
|
3
|
+
const i = {
|
|
4
|
+
key: 0,
|
|
5
|
+
class: "badge-stack"
|
|
6
|
+
}, g = {
|
|
4
7
|
__name: "UluBadgeStack",
|
|
5
8
|
props: {
|
|
6
9
|
/**
|
|
@@ -8,17 +11,17 @@ const _ = { class: "badge-stack" }, f = {
|
|
|
8
11
|
*/
|
|
9
12
|
items: Array
|
|
10
13
|
},
|
|
11
|
-
setup(
|
|
12
|
-
return (
|
|
13
|
-
(
|
|
14
|
+
setup(r) {
|
|
15
|
+
return (_, d) => r.items?.length ? (t(), e("ul", i, [
|
|
16
|
+
(t(!0), e(m, null, n(r.items, (a, s) => (t(), e("li", {
|
|
14
17
|
class: "badge-stack__item",
|
|
15
18
|
key: s
|
|
16
19
|
}, [
|
|
17
|
-
|
|
20
|
+
o(u, l({ ref_for: !0 }, a), null, 16)
|
|
18
21
|
]))), 128))
|
|
19
|
-
]));
|
|
22
|
+
])) : c("", !0);
|
|
20
23
|
}
|
|
21
24
|
};
|
|
22
25
|
export {
|
|
23
|
-
|
|
26
|
+
g as default
|
|
24
27
|
};
|
|
@@ -26,7 +26,7 @@ declare const __VLS_component: import('vue').DefineComponent<{}, {
|
|
|
26
26
|
readonly modifiers?: string | unknown[] | undefined;
|
|
27
27
|
readonly items?: unknown[] | undefined;
|
|
28
28
|
};
|
|
29
|
-
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {},
|
|
29
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
30
30
|
type __VLS_TemplateResult = {
|
|
31
31
|
attrs: Partial<{}>;
|
|
32
32
|
slots: {
|
|
@@ -40,6 +40,6 @@ type __VLS_TemplateResult = {
|
|
|
40
40
|
}): any;
|
|
41
41
|
};
|
|
42
42
|
refs: {};
|
|
43
|
-
rootEl:
|
|
43
|
+
rootEl: any;
|
|
44
44
|
};
|
|
45
45
|
//# sourceMappingURL=UluDefinitionList.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UluDefinitionList.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/elements/UluDefinitionList.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UluDefinitionList.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/elements/UluDefinitionList.vue"],"names":[],"mappings":"AAyBA;wBA0OqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAVjC;;;;;;;;;;;;;;;;;;;;;;;2OAOG"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { computed as u, createElementBlock as l, openBlock as n, normalizeClass as a, unref as
|
|
2
|
-
import { useModifiers as
|
|
1
|
+
import { computed as u, createElementBlock as l, createCommentVNode as B, openBlock as n, normalizeClass as a, unref as y, Fragment as b, renderList as g, createElementVNode as o, renderSlot as c, createTextVNode as d, toDisplayString as m } from "vue";
|
|
2
|
+
import { useModifiers as k } from "../../composables/useModifiers.js";
|
|
3
3
|
const F = {
|
|
4
4
|
__name: "UluDefinitionList",
|
|
5
5
|
props: {
|
|
@@ -57,15 +57,16 @@ const F = {
|
|
|
57
57
|
"separated-first": e.separatedFirst,
|
|
58
58
|
"separated-last": e.separatedLast,
|
|
59
59
|
compact: e.compact
|
|
60
|
-
})), { resolvedModifiers: f } =
|
|
60
|
+
})), { resolvedModifiers: f } = k({
|
|
61
61
|
props: e,
|
|
62
62
|
internal: p,
|
|
63
63
|
baseClass: "definition-list"
|
|
64
64
|
});
|
|
65
|
-
return (r,
|
|
66
|
-
|
|
65
|
+
return (r, A) => t.items?.length ? (n(), l("dl", {
|
|
66
|
+
key: 0,
|
|
67
|
+
class: a(["definition-list", [y(f), t.classes.list]])
|
|
67
68
|
}, [
|
|
68
|
-
(n(!0), l(b, null,
|
|
69
|
+
(n(!0), l(b, null, g(t.items, (s, i) => (n(), l("div", {
|
|
69
70
|
key: i,
|
|
70
71
|
class: a(t.classes.item)
|
|
71
72
|
}, [
|
|
@@ -90,7 +91,7 @@ const F = {
|
|
|
90
91
|
])
|
|
91
92
|
], 2)
|
|
92
93
|
], 2))), 128))
|
|
93
|
-
], 2));
|
|
94
|
+
], 2)) : B("", !0);
|
|
94
95
|
}
|
|
95
96
|
};
|
|
96
97
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UluList.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/elements/UluList.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UluList.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/elements/UluList.vue"],"names":[],"mappings":"AA8BA;wBA2OqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAVjC;;;;;;;;;;;;;;;;;;;;;;;2OAOG"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
const
|
|
1
|
+
import { computed as n, createBlock as m, createCommentVNode as u, openBlock as t, resolveDynamicComponent as y, normalizeStyle as B, normalizeClass as o, withCtx as f, createElementBlock as d, Fragment as v, renderList as S, renderSlot as g, createTextVNode as k, toDisplayString as C } from "vue";
|
|
2
|
+
const h = {
|
|
3
3
|
__name: "UluList",
|
|
4
4
|
props: {
|
|
5
5
|
/**
|
|
@@ -49,9 +49,10 @@ const x = {
|
|
|
49
49
|
listStyleType: String
|
|
50
50
|
},
|
|
51
51
|
setup(e) {
|
|
52
|
-
const l = e, r =
|
|
53
|
-
return (i, O) => (t(),
|
|
54
|
-
|
|
52
|
+
const l = e, r = n(() => l.ordered || l.forceOrdered), c = n(() => r.value ? "ol" : "ul");
|
|
53
|
+
return (i, O) => e.items?.length ? (t(), m(y(c.value), {
|
|
54
|
+
key: 0,
|
|
55
|
+
class: o([
|
|
55
56
|
{
|
|
56
57
|
"list-ordered": e.ordered,
|
|
57
58
|
"list-unordered": e.unordered,
|
|
@@ -60,29 +61,29 @@ const x = {
|
|
|
60
61
|
},
|
|
61
62
|
e.classes.list
|
|
62
63
|
]),
|
|
63
|
-
style:
|
|
64
|
+
style: B({
|
|
64
65
|
listStyleType: e.listStyleType
|
|
65
66
|
}),
|
|
66
67
|
reversed: r.value ? e.reversed : null,
|
|
67
68
|
start: e.start
|
|
68
69
|
}, {
|
|
69
|
-
default:
|
|
70
|
-
(t(!0), d(
|
|
70
|
+
default: f(() => [
|
|
71
|
+
(t(!0), d(v, null, S(e.items, (s, a) => (t(), d("li", {
|
|
71
72
|
key: a,
|
|
72
|
-
class:
|
|
73
|
+
class: o(e.classes.listItem)
|
|
73
74
|
}, [
|
|
74
|
-
|
|
75
|
+
g(i.$slots, "default", {
|
|
75
76
|
item: s,
|
|
76
77
|
index: a
|
|
77
78
|
}, () => [
|
|
78
|
-
|
|
79
|
+
k(C(s), 1)
|
|
79
80
|
])
|
|
80
81
|
], 2))), 128))
|
|
81
82
|
]),
|
|
82
83
|
_: 3
|
|
83
|
-
}, 8, ["class", "style", "reversed", "start"]));
|
|
84
|
+
}, 8, ["class", "style", "reversed", "start"])) : u("", !0);
|
|
84
85
|
}
|
|
85
86
|
};
|
|
86
87
|
export {
|
|
87
|
-
|
|
88
|
+
h as default
|
|
88
89
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UluMenu.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/navigation/UluMenu.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UluMenu.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/navigation/UluMenu.vue"],"names":[],"mappings":"AAsDA;;IAuIM;;;;;;;;;;;OAWG;;IAEH;;;OAGG;;;;;IAKH;;OAEG;;IAEH;;OAEG;;;;;IA3BH;;;;;;;;;;;OAWG;;IAEH;;;OAGG;;;;;IAKH;;OAEG;;IAEH;;OAEG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UluMenuStack.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/navigation/UluMenuStack.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UluMenuStack.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/navigation/UluMenuStack.vue"],"names":[],"mappings":"AAsBA;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { computed as i, createBlock as o,
|
|
2
|
-
import
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
const
|
|
1
|
+
import { computed as i, createBlock as o, createCommentVNode as r, openBlock as s, resolveDynamicComponent as m, normalizeClass as c, unref as l, withCtx as u, createVNode as k } from "vue";
|
|
2
|
+
import f from "./UluMenu.vue.js";
|
|
3
|
+
import { useModifiers as d } from "../../composables/useModifiers.js";
|
|
4
|
+
const B = {
|
|
5
5
|
__name: "UluMenuStack",
|
|
6
6
|
props: {
|
|
7
7
|
/**
|
|
@@ -33,19 +33,20 @@ const C = {
|
|
|
33
33
|
modifiers: [String, Array]
|
|
34
34
|
},
|
|
35
35
|
setup(e) {
|
|
36
|
-
const
|
|
37
|
-
hanging:
|
|
38
|
-
compact:
|
|
39
|
-
})), { resolvedModifiers: a } =
|
|
40
|
-
props:
|
|
41
|
-
internal:
|
|
36
|
+
const t = e, n = i(() => ({
|
|
37
|
+
hanging: t.hanging,
|
|
38
|
+
compact: t.compact
|
|
39
|
+
})), { resolvedModifiers: a } = d({
|
|
40
|
+
props: t,
|
|
41
|
+
internal: n,
|
|
42
42
|
baseClass: "menu-stack"
|
|
43
43
|
});
|
|
44
|
-
return (_,
|
|
45
|
-
|
|
44
|
+
return (_, p) => e.items?.length ? (s(), o(m(e.containerElement), {
|
|
45
|
+
key: 0,
|
|
46
|
+
class: c(["menu-stack", l(a)])
|
|
46
47
|
}, {
|
|
47
|
-
default:
|
|
48
|
-
|
|
48
|
+
default: u(() => [
|
|
49
|
+
k(f, {
|
|
49
50
|
items: e.items,
|
|
50
51
|
classes: {
|
|
51
52
|
list: "menu-stack__list",
|
|
@@ -60,9 +61,9 @@ const C = {
|
|
|
60
61
|
}, null, 8, ["items", "noChildren"])
|
|
61
62
|
]),
|
|
62
63
|
_: 1
|
|
63
|
-
}, 8, ["class"]));
|
|
64
|
+
}, 8, ["class"])) : r("", !0);
|
|
64
65
|
}
|
|
65
66
|
};
|
|
66
67
|
export {
|
|
67
|
-
|
|
68
|
+
B as default
|
|
68
69
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UluNavStrip.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/navigation/UluNavStrip.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UluNavStrip.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/navigation/UluNavStrip.vue"],"names":[],"mappings":"AAqBA;;IAyDM;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;IAdH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import n from "./UluMenu.vue.js";
|
|
2
|
-
import { resolveComponent as r, createElementBlock as i,
|
|
3
|
-
import
|
|
4
|
-
const
|
|
2
|
+
import { resolveComponent as r, createElementBlock as i, createCommentVNode as o, openBlock as a, normalizeClass as s, createVNode as l } from "vue";
|
|
3
|
+
import c from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const m = {
|
|
5
5
|
name: "UluNavStrip",
|
|
6
6
|
components: {
|
|
7
7
|
UluMenu: n
|
|
@@ -25,16 +25,17 @@ const c = {
|
|
|
25
25
|
rule: Boolean
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
-
function
|
|
28
|
+
function u(_, p, e, v, f, d) {
|
|
29
29
|
const t = r("UluMenu");
|
|
30
|
-
return
|
|
30
|
+
return e.items?.length ? (a(), i("nav", {
|
|
31
|
+
key: 0,
|
|
31
32
|
class: s(["nav-strip", {
|
|
32
33
|
"nav-strip--rule": e.rule,
|
|
33
34
|
"nav-strip--center": e.center,
|
|
34
35
|
"nav-strip--right": e.right
|
|
35
36
|
}])
|
|
36
37
|
}, [
|
|
37
|
-
|
|
38
|
+
l(t, {
|
|
38
39
|
items: e.items,
|
|
39
40
|
classes: {
|
|
40
41
|
list: "nav-strip__list",
|
|
@@ -43,9 +44,9 @@ function m(p, u, e, _, v, f) {
|
|
|
43
44
|
linkExactActive: "is-active"
|
|
44
45
|
}
|
|
45
46
|
}, null, 8, ["items"])
|
|
46
|
-
], 2);
|
|
47
|
+
], 2)) : o("", !0);
|
|
47
48
|
}
|
|
48
|
-
const U = /* @__PURE__ */
|
|
49
|
+
const U = /* @__PURE__ */ c(m, [["render", u]]);
|
|
49
50
|
export {
|
|
50
51
|
U as default
|
|
51
52
|
};
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* @param {Object} [options.urlSync] - Optional configuration to sync state with URL.
|
|
15
15
|
* @param {import('vue-router').Router} [options.urlSync.router] - The Vue Router instance.
|
|
16
16
|
* @param {import('vue-router').RouteLocationNormalizedLoaded} [options.urlSync.route] - The current route instance.
|
|
17
|
+
* @param {Function} [options.isPinned] - A function that receives an item and returns true if it should be pinned to the top of the results.
|
|
17
18
|
*/
|
|
18
19
|
export function useFacets(allItems: import('vue').Ref<Array<Object>>, options?: {
|
|
19
20
|
initialFacets?: any[] | undefined;
|
|
@@ -29,6 +30,7 @@ export function useFacets(allItems: import('vue').Ref<Array<Object>>, options?:
|
|
|
29
30
|
router?: import('vue-router').Router | undefined;
|
|
30
31
|
route?: import('vue-router').RouteLocationNormalizedLoadedGeneric | undefined;
|
|
31
32
|
} | undefined;
|
|
33
|
+
isPinned?: Function | undefined;
|
|
32
34
|
}): {
|
|
33
35
|
facets: import('vue').Ref<never[], never[]>;
|
|
34
36
|
searchValue: import('vue').Ref<string, string>;
|
|
@@ -51,6 +53,7 @@ export function useFacets(allItems: import('vue').Ref<Array<Object>>, options?:
|
|
|
51
53
|
} | undefined;
|
|
52
54
|
}>;
|
|
53
55
|
displayItems: import('vue').ComputedRef<any>;
|
|
56
|
+
pinnedItems: import('vue').ComputedRef<any[] | never[]>;
|
|
54
57
|
selectedFacets: import('vue').ComputedRef<any[]>;
|
|
55
58
|
clearFilters: () => void;
|
|
56
59
|
handleFacetChange: ({ groupUid, facetUid, selected }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFacets.d.ts","sourceRoot":"","sources":["../../../../lib/components/systems/facets/useFacets.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useFacets.d.ts","sourceRoot":"","sources":["../../../../lib/components/systems/facets/useFacets.js"],"names":[],"mappings":"AAiHA;;;;;;;;;;;;;;;;;GAiBG;AACH,oCAhBW,OAAO,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,YAExC;IAAwB,aAAa;IACb,WAAW;IACV,kBAAkB;IAClB,eAAe;IACd,cAAc;IACf,cAAc;IACd,aAAa;IACX,YAAY;IACd,SAAS;IACT,OAAO;;;;IAGL,QAAQ;CACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+WA"}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { ref as T, computed as
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { ref as T, computed as E, watch as $, watchPostEffect as X } from "vue";
|
|
2
|
+
import Y from "fuse.js";
|
|
3
|
+
const Z = (u) => typeof u == "function";
|
|
4
|
+
function ee(u) {
|
|
4
5
|
const h = /* @__PURE__ */ new Set();
|
|
5
6
|
for (const d of u)
|
|
6
|
-
for (const
|
|
7
|
-
h.add(
|
|
7
|
+
for (const a of d)
|
|
8
|
+
h.add(a);
|
|
8
9
|
return h;
|
|
9
10
|
}
|
|
10
11
|
function k(u) {
|
|
11
12
|
if (!u || u.length === 0) return /* @__PURE__ */ new Set();
|
|
12
|
-
const h = u.sort((
|
|
13
|
-
for (let
|
|
13
|
+
const h = u.sort((a, S) => a.size - S.size), d = new Set(h[0]);
|
|
14
|
+
for (let a = 1; a < h.length; a++) {
|
|
14
15
|
for (const S of d)
|
|
15
|
-
h[
|
|
16
|
+
h[a].has(S) || d.delete(S);
|
|
16
17
|
if (d.size === 0) break;
|
|
17
18
|
}
|
|
18
19
|
return d;
|
|
@@ -20,207 +21,218 @@ function k(u) {
|
|
|
20
21
|
function O(u, h, d) {
|
|
21
22
|
if (!u || u.length === 0)
|
|
22
23
|
return d;
|
|
23
|
-
const
|
|
24
|
-
const z = S.children.map((
|
|
25
|
-
const v = `${S.uid}:${
|
|
24
|
+
const a = u.map((S) => {
|
|
25
|
+
const z = S.children.map((V) => {
|
|
26
|
+
const v = `${S.uid}:${V.uid}`;
|
|
26
27
|
return h.get(v) || /* @__PURE__ */ new Set();
|
|
27
28
|
});
|
|
28
|
-
return S.match === "all" ? k(z) :
|
|
29
|
+
return S.match === "all" ? k(z) : ee(z);
|
|
29
30
|
});
|
|
30
|
-
return k(
|
|
31
|
+
return k(a);
|
|
31
32
|
}
|
|
32
|
-
function
|
|
33
|
+
function te(u, h) {
|
|
33
34
|
return !h || !Array.isArray(h) ? [] : h.map((d) => {
|
|
34
|
-
const
|
|
35
|
+
const a = /* @__PURE__ */ new Set(), S = d.getValue || ((v) => v[d.uid]);
|
|
35
36
|
u.forEach((v) => {
|
|
36
|
-
const
|
|
37
|
-
Array.isArray(
|
|
37
|
+
const F = S(v);
|
|
38
|
+
Array.isArray(F) ? F.forEach((A) => A && a.add(A)) : F && a.add(F);
|
|
38
39
|
});
|
|
39
|
-
const z = d.getLabel || ((v) => v),
|
|
40
|
+
const z = d.getLabel || ((v) => v), V = [...a].map((v) => ({
|
|
40
41
|
uid: v,
|
|
41
42
|
label: z(v),
|
|
42
43
|
selected: !1
|
|
43
44
|
}));
|
|
44
|
-
return
|
|
45
|
+
return V.sort((v, F) => String(v.label).localeCompare(String(F.label))), {
|
|
45
46
|
...d,
|
|
46
|
-
children:
|
|
47
|
+
children: V
|
|
47
48
|
};
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
+
function re(u, h = {}) {
|
|
51
52
|
const {
|
|
52
53
|
initialFacets: d,
|
|
53
|
-
facetFields:
|
|
54
|
+
facetFields: a,
|
|
54
55
|
initialSearchValue: S = "",
|
|
55
56
|
initialSortType: z = "az",
|
|
56
|
-
noDefaultSorts:
|
|
57
|
+
noDefaultSorts: V = !1,
|
|
57
58
|
extraSortTypes: v = {},
|
|
58
|
-
searchOptions:
|
|
59
|
-
getSortValue:
|
|
59
|
+
searchOptions: F = {},
|
|
60
|
+
getSortValue: A = (e) => e.title || e.label || "",
|
|
60
61
|
countMode: q = "none",
|
|
61
62
|
// 'none', 'simple', 'intuitive'
|
|
62
|
-
urlSync: U
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
urlSync: U,
|
|
64
|
+
isPinned: B
|
|
65
|
+
} = h, _ = (e) => e.sort((t, r) => {
|
|
66
|
+
const n = A(t), s = A(r);
|
|
65
67
|
return n && s ? String(n).localeCompare(String(s)) : n ? -1 : s ? 1 : 0;
|
|
66
|
-
}),
|
|
67
|
-
az: { text: "A-Z", sort:
|
|
68
|
-
za: { text: "Z-A", sort: (e) =>
|
|
68
|
+
}), j = {
|
|
69
|
+
az: { text: "A-Z", sort: _ },
|
|
70
|
+
za: { text: "Z-A", sort: (e) => _(e).reverse() }
|
|
69
71
|
};
|
|
70
|
-
function
|
|
72
|
+
function D(e) {
|
|
71
73
|
return (e || []).map((t) => ({
|
|
72
74
|
...t,
|
|
73
75
|
open: t.open || !1,
|
|
74
|
-
children: t.children.map((
|
|
75
|
-
...
|
|
76
|
-
selected:
|
|
76
|
+
children: t.children.map((r) => ({
|
|
77
|
+
...r,
|
|
78
|
+
selected: r.selected || !1
|
|
77
79
|
})),
|
|
78
80
|
selectedCount: 0
|
|
79
81
|
}));
|
|
80
82
|
}
|
|
81
|
-
const f = T([]), x = T(S),
|
|
82
|
-
...
|
|
83
|
+
const f = T([]), x = T(S), I = T(z), G = E(() => !a || !u.value?.length ? null : te(u.value, a)), J = E(() => ({
|
|
84
|
+
...V ? {} : j,
|
|
83
85
|
...v
|
|
84
|
-
})), M =
|
|
86
|
+
})), M = E(() => {
|
|
85
87
|
const e = /* @__PURE__ */ new Map(), t = y.value;
|
|
86
|
-
if (!t || !
|
|
87
|
-
const
|
|
88
|
+
if (!t || !a) return e;
|
|
89
|
+
const r = new Map(a.map((n) => {
|
|
88
90
|
const s = n.getValue || ((o) => o[n.uid]);
|
|
89
91
|
return [n.uid, s];
|
|
90
92
|
}));
|
|
91
93
|
for (let n = 0; n < t.length; n++) {
|
|
92
94
|
const s = t[n];
|
|
93
|
-
for (const o of
|
|
94
|
-
const
|
|
95
|
-
for (const m of
|
|
95
|
+
for (const o of a) {
|
|
96
|
+
const l = r.get(o.uid)(s), c = Array.isArray(l) ? l : l ? [l] : [];
|
|
97
|
+
for (const m of c) {
|
|
96
98
|
const p = `${o.uid}:${m}`;
|
|
97
99
|
e.has(p) || e.set(p, /* @__PURE__ */ new Set()), e.get(p).add(n);
|
|
98
100
|
}
|
|
99
101
|
}
|
|
100
102
|
}
|
|
101
103
|
return e;
|
|
102
|
-
}),
|
|
104
|
+
}), R = E(() => ({
|
|
103
105
|
shouldSort: !0,
|
|
104
106
|
keys: ["title", "label", "description", "author"],
|
|
105
|
-
...
|
|
106
|
-
})), y =
|
|
107
|
+
...F
|
|
108
|
+
})), y = E(() => x.value?.length ? new Y(u.value, R.value).search(x.value).map((t) => t.item) : u.value), b = E(() => {
|
|
107
109
|
const e = [];
|
|
108
110
|
return f.value.forEach((t) => {
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
+
const r = t.children.filter((n) => n.selected);
|
|
112
|
+
r.length > 0 && e.push({ ...t, children: r });
|
|
111
113
|
}), e;
|
|
112
|
-
}),
|
|
113
|
-
if (!
|
|
114
|
+
}), L = E(() => {
|
|
115
|
+
if (!b.value.length)
|
|
114
116
|
return y.value;
|
|
115
117
|
const e = M.value;
|
|
116
|
-
if (e.size === 0 && y.value.length > 0 &&
|
|
118
|
+
if (e.size === 0 && y.value.length > 0 && a?.length > 0)
|
|
117
119
|
return [];
|
|
118
|
-
const t = new Set(y.value.map((s, o) => o)),
|
|
119
|
-
for (const s of
|
|
120
|
+
const t = new Set(y.value.map((s, o) => o)), r = O(b.value, e, t), n = [];
|
|
121
|
+
for (const s of r)
|
|
120
122
|
n.push(y.value[s]);
|
|
121
123
|
return n;
|
|
122
|
-
}),
|
|
123
|
-
const e =
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
}), N = E(() => {
|
|
125
|
+
const e = J.value[I.value]?.sort;
|
|
126
|
+
let t = Z(e) ? e([...L.value]) : [...L.value];
|
|
127
|
+
if (Z(B)) {
|
|
128
|
+
const r = [], n = [];
|
|
129
|
+
return t.forEach((s) => B(s) ? r.push(s) : n.push(s)), { pinned: r, unpinned: n, all: [...r, ...n] };
|
|
130
|
+
}
|
|
131
|
+
return { pinned: [], unpinned: t, all: t };
|
|
132
|
+
}), W = E(() => N.value.all), H = E(() => N.value.pinned);
|
|
133
|
+
function K() {
|
|
127
134
|
f.value.forEach((e) => {
|
|
128
135
|
e.children && e.children.forEach((t) => t.selected = !1), e.selectedCount = 0;
|
|
129
136
|
});
|
|
130
137
|
}
|
|
131
|
-
function
|
|
138
|
+
function P({ groupUid: e, facetUid: t, selected: r }) {
|
|
132
139
|
const n = f.value.find((s) => s.uid === e);
|
|
133
140
|
if (n) {
|
|
134
|
-
!n.multiple &&
|
|
141
|
+
!n.multiple && r && n.children.forEach((o) => {
|
|
135
142
|
o.uid !== t && (o.selected = !1);
|
|
136
143
|
});
|
|
137
144
|
const s = n.children.find((o) => o.uid === t);
|
|
138
|
-
s && (s.selected =
|
|
145
|
+
s && (s.selected = r), n.selectedCount = n.children.filter((o) => o.selected).length;
|
|
139
146
|
}
|
|
140
147
|
}
|
|
141
|
-
if ($(
|
|
142
|
-
const t =
|
|
143
|
-
t.forEach((
|
|
144
|
-
|
|
148
|
+
if ($(G, (e) => {
|
|
149
|
+
const t = D(d || e);
|
|
150
|
+
t.forEach((r) => {
|
|
151
|
+
r.selectedCount = r.children.filter((n) => n.selected).length;
|
|
145
152
|
}), f.value = t;
|
|
146
|
-
}, { immediate: !0 }), $([
|
|
147
|
-
if (!(q === "none" || !f.value.length) && !(e ===
|
|
153
|
+
}, { immediate: !0 }), $([b, y], ([e, t], [r, n]) => {
|
|
154
|
+
if (!(q === "none" || !f.value.length) && !(e === r && t === n)) {
|
|
148
155
|
if (q === "simple") {
|
|
149
156
|
const s = M.value;
|
|
150
|
-
if (s.size === 0 && y.value.length > 0 &&
|
|
157
|
+
if (s.size === 0 && y.value.length > 0 && a?.length > 0)
|
|
151
158
|
return;
|
|
152
|
-
const o = new Set(y.value.map((
|
|
153
|
-
f.value.forEach((
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
const p = `${
|
|
159
|
+
const o = new Set(y.value.map((i, l) => l));
|
|
160
|
+
f.value.forEach((i) => {
|
|
161
|
+
const l = e.filter((m) => m.uid !== i.uid), c = O(l, s, o);
|
|
162
|
+
i.children.forEach((m) => {
|
|
163
|
+
const p = `${i.uid}:${m.uid}`, g = s.get(p) || /* @__PURE__ */ new Set(), w = k([c, g]);
|
|
157
164
|
m.count = w.size;
|
|
158
165
|
});
|
|
159
166
|
});
|
|
160
167
|
} else if (q === "intuitive") {
|
|
161
168
|
const s = M.value;
|
|
162
|
-
if (s.size === 0 && y.value.length > 0 &&
|
|
169
|
+
if (s.size === 0 && y.value.length > 0 && a?.length > 0)
|
|
163
170
|
return;
|
|
164
|
-
const o = new Set(y.value.map((
|
|
165
|
-
f.value.forEach((
|
|
166
|
-
|
|
167
|
-
const m = `${
|
|
168
|
-
if (
|
|
169
|
-
if (
|
|
170
|
-
const g = k([
|
|
171
|
-
|
|
171
|
+
const o = new Set(y.value.map((l, c) => c)), i = O(e, s, o);
|
|
172
|
+
f.value.forEach((l) => {
|
|
173
|
+
l.children.forEach((c) => {
|
|
174
|
+
const m = `${l.uid}:${c.uid}`, p = s.get(m) || /* @__PURE__ */ new Set();
|
|
175
|
+
if (c.selected)
|
|
176
|
+
if (l.multiple) {
|
|
177
|
+
const g = k([i, p]);
|
|
178
|
+
c.count = g.size;
|
|
172
179
|
} else
|
|
173
|
-
|
|
180
|
+
c.count = i.size;
|
|
174
181
|
else {
|
|
175
182
|
const g = [];
|
|
176
183
|
for (const C of e)
|
|
177
184
|
g.push({ ...C, children: [...C.children] });
|
|
178
|
-
let w = g.find((C) => C.uid ===
|
|
179
|
-
w || (w = { ...
|
|
180
|
-
const
|
|
181
|
-
|
|
185
|
+
let w = g.find((C) => C.uid === l.uid);
|
|
186
|
+
w || (w = { ...l, children: [] }, g.push(w)), l.multiple ? w.children.push(c) : w.children = [c];
|
|
187
|
+
const Q = O(g, s, o);
|
|
188
|
+
c.count = Q.size;
|
|
182
189
|
}
|
|
183
190
|
});
|
|
184
191
|
});
|
|
185
192
|
}
|
|
186
193
|
}
|
|
187
194
|
}, { deep: !0, immediate: !0 }), U?.router && U?.route) {
|
|
188
|
-
const { router: e, route: t } = U,
|
|
189
|
-
if (!
|
|
190
|
-
const
|
|
191
|
-
delete
|
|
192
|
-
|
|
193
|
-
}), JSON.stringify(
|
|
195
|
+
const { router: e, route: t } = U, r = () => f.value && f.value.length > 0, n = () => {
|
|
196
|
+
if (!r()) return;
|
|
197
|
+
const i = { ...t.query };
|
|
198
|
+
delete i.sort, delete i.search, f.value.forEach((l) => delete i[l.uid]), I.value && I.value !== z && (i.sort = I.value), x.value && (i.search = x.value), b.value.forEach((l) => {
|
|
199
|
+
l.children.length > 0 && (i[l.uid] = l.children.map((c) => c.uid).join(","));
|
|
200
|
+
}), JSON.stringify(i) !== JSON.stringify(t.query) && e.push({ query: i });
|
|
194
201
|
}, s = () => {
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
const
|
|
198
|
-
f.value.forEach((
|
|
199
|
-
const m =
|
|
200
|
-
|
|
201
|
-
}), f.value.forEach((
|
|
202
|
-
const m =
|
|
203
|
-
|
|
202
|
+
const i = t.query;
|
|
203
|
+
i.sort && (I.value = i.sort), i.search && (x.value = i.search);
|
|
204
|
+
const l = /* @__PURE__ */ new Map();
|
|
205
|
+
f.value.forEach((c) => {
|
|
206
|
+
const m = i[c.uid] ? i[c.uid].split(",") : [];
|
|
207
|
+
l.set(c.uid, new Set(m));
|
|
208
|
+
}), f.value.forEach((c) => {
|
|
209
|
+
const m = l.get(c.uid) || /* @__PURE__ */ new Set();
|
|
210
|
+
c.children.forEach((p) => {
|
|
204
211
|
const g = p.selected, w = m.has(p.uid);
|
|
205
|
-
g !== w &&
|
|
212
|
+
g !== w && P({ groupUid: c.uid, facetUid: p.uid, selected: w });
|
|
206
213
|
});
|
|
207
214
|
});
|
|
208
|
-
}, o =
|
|
215
|
+
}, o = X(() => {
|
|
209
216
|
f.value && f.value.length > 0 && (s(), o());
|
|
210
217
|
});
|
|
211
|
-
$(
|
|
218
|
+
$(
|
|
219
|
+
[I, x, b],
|
|
220
|
+
n,
|
|
221
|
+
{ deep: !0 }
|
|
222
|
+
), $(() => t.query, s);
|
|
212
223
|
}
|
|
213
224
|
return {
|
|
214
225
|
facets: f,
|
|
215
226
|
searchValue: x,
|
|
216
|
-
selectedSort:
|
|
217
|
-
sortTypes:
|
|
218
|
-
displayItems:
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
227
|
+
selectedSort: I,
|
|
228
|
+
sortTypes: J,
|
|
229
|
+
displayItems: W,
|
|
230
|
+
pinnedItems: H,
|
|
231
|
+
selectedFacets: b,
|
|
232
|
+
clearFilters: K,
|
|
233
|
+
handleFacetChange: P
|
|
222
234
|
};
|
|
223
235
|
}
|
|
224
236
|
export {
|
|
225
|
-
|
|
237
|
+
re as useFacets
|
|
226
238
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { ref, computed, watch,
|
|
2
|
-
import Fuse from
|
|
1
|
+
import { ref, computed, watch, watchPostEffect } from "vue";
|
|
2
|
+
import Fuse from "fuse.js";
|
|
3
|
+
|
|
4
|
+
const isFunction = v => typeof v === "function";
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* Helper function to create a union of multiple Sets.
|
|
@@ -58,7 +60,7 @@ function getFilteredSetFromIndex(selected, index, allItemsSet) {
|
|
|
58
60
|
});
|
|
59
61
|
|
|
60
62
|
// For 'all' (AND), intersect the sets within the group.
|
|
61
|
-
if (group.match ===
|
|
63
|
+
if (group.match === "all") {
|
|
62
64
|
return intersectSets(childSets);
|
|
63
65
|
}
|
|
64
66
|
// For 'some' (OR), union the sets within the group.
|
|
@@ -125,19 +127,21 @@ function generateInitialFacets(allItems, facetFields) {
|
|
|
125
127
|
* @param {Object} [options.urlSync] - Optional configuration to sync state with URL.
|
|
126
128
|
* @param {import('vue-router').Router} [options.urlSync.router] - The Vue Router instance.
|
|
127
129
|
* @param {import('vue-router').RouteLocationNormalizedLoaded} [options.urlSync.route] - The current route instance.
|
|
130
|
+
* @param {Function} [options.isPinned] - A function that receives an item and returns true if it should be pinned to the top of the results.
|
|
128
131
|
*/
|
|
129
132
|
export function useFacets(allItems, options = {}) {
|
|
130
133
|
const {
|
|
131
134
|
initialFacets,
|
|
132
135
|
facetFields,
|
|
133
|
-
initialSearchValue =
|
|
134
|
-
initialSortType =
|
|
136
|
+
initialSearchValue = "",
|
|
137
|
+
initialSortType = "az",
|
|
135
138
|
noDefaultSorts = false,
|
|
136
139
|
extraSortTypes = {},
|
|
137
140
|
searchOptions: initialSearchOptions = {},
|
|
138
141
|
getSortValue = item => (item.title || item.label || ""),
|
|
139
|
-
countMode =
|
|
140
|
-
urlSync: urlSyncOptions
|
|
142
|
+
countMode = "none", // 'none', 'simple', 'intuitive'
|
|
143
|
+
urlSync: urlSyncOptions,
|
|
144
|
+
isPinned
|
|
141
145
|
} = options;
|
|
142
146
|
|
|
143
147
|
const sortAlpha = items => {
|
|
@@ -261,14 +265,22 @@ export function useFacets(allItems, options = {}) {
|
|
|
261
265
|
return result;
|
|
262
266
|
});
|
|
263
267
|
|
|
264
|
-
const
|
|
268
|
+
const displayItemsGrouped = computed(() => {
|
|
265
269
|
const sortFn = sortTypes.value[selectedSort.value]?.sort;
|
|
266
|
-
|
|
267
|
-
|
|
270
|
+
let sorted = isFunction(sortFn) ? sortFn([...filteredItems.value]) : [...filteredItems.value];
|
|
271
|
+
|
|
272
|
+
if (isFunction(isPinned)) {
|
|
273
|
+
const pinned = [];
|
|
274
|
+
const unpinned = [];
|
|
275
|
+
sorted.forEach(item => isPinned(item) ? pinned.push(item) : unpinned.push(item));
|
|
276
|
+
return { pinned, unpinned, all: [...pinned, ...unpinned] };
|
|
268
277
|
}
|
|
269
|
-
return
|
|
278
|
+
return { pinned: [], unpinned: sorted, all: sorted };
|
|
270
279
|
});
|
|
271
280
|
|
|
281
|
+
const displayItems = computed(() => displayItemsGrouped.value.all);
|
|
282
|
+
const pinnedItems = computed(() => displayItemsGrouped.value.pinned);
|
|
283
|
+
|
|
272
284
|
// --- Methods ---
|
|
273
285
|
function clearFilters() {
|
|
274
286
|
facets.value.forEach(group => {
|
|
@@ -309,12 +321,12 @@ export function useFacets(allItems, options = {}) {
|
|
|
309
321
|
}, { immediate: true });
|
|
310
322
|
|
|
311
323
|
watch([selectedFacets, searchedItems], ([currentSelected, currentSearchedItems], [prevSelected, prevSearchedItems]) => {
|
|
312
|
-
if (countMode ===
|
|
324
|
+
if (countMode === "none" || !facets.value.length) return;
|
|
313
325
|
|
|
314
326
|
// A simple optimization to prevent re-calculating counts if the actual data hasn't changed.
|
|
315
327
|
if (currentSelected === prevSelected && currentSearchedItems === prevSearchedItems) return;
|
|
316
328
|
|
|
317
|
-
if (countMode ===
|
|
329
|
+
if (countMode === "simple") {
|
|
318
330
|
const index = facetIndex.value;
|
|
319
331
|
if (index.size === 0 && searchedItems.value.length > 0 && facetFields?.length > 0) {
|
|
320
332
|
return; // Index not ready
|
|
@@ -337,7 +349,7 @@ export function useFacets(allItems, options = {}) {
|
|
|
337
349
|
child.count = intersection.size;
|
|
338
350
|
});
|
|
339
351
|
});
|
|
340
|
-
} else if (countMode ===
|
|
352
|
+
} else if (countMode === "intuitive") {
|
|
341
353
|
const index = facetIndex.value;
|
|
342
354
|
if (index.size === 0 && searchedItems.value.length > 0 && facetFields?.length > 0) {
|
|
343
355
|
// Index might not be ready yet.
|
|
@@ -348,7 +360,7 @@ export function useFacets(allItems, options = {}) {
|
|
|
348
360
|
|
|
349
361
|
facets.value.forEach(group => {
|
|
350
362
|
group.children.forEach(child => {
|
|
351
|
-
const key = `${group.uid}:${child.uid}`;
|
|
363
|
+
const key = `${ group.uid }:${ child.uid }`;
|
|
352
364
|
const childSet = index.get(key) || new Set();
|
|
353
365
|
|
|
354
366
|
if (child.selected) {
|
|
@@ -438,7 +450,7 @@ export function useFacets(allItems, options = {}) {
|
|
|
438
450
|
|
|
439
451
|
const selectionsFromUrl = new Map();
|
|
440
452
|
facets.value.forEach(group => {
|
|
441
|
-
const selectedUids = query[group.uid] ? query[group.uid].split(
|
|
453
|
+
const selectedUids = query[group.uid] ? query[group.uid].split(",") : [];
|
|
442
454
|
selectionsFromUrl.set(group.uid, new Set(selectedUids));
|
|
443
455
|
});
|
|
444
456
|
|
|
@@ -463,7 +475,10 @@ export function useFacets(allItems, options = {}) {
|
|
|
463
475
|
});
|
|
464
476
|
|
|
465
477
|
// Sync state changes TO the URL
|
|
466
|
-
watch(
|
|
478
|
+
watch(
|
|
479
|
+
[selectedSort, searchValue, selectedFacets], updateUrlFromState,
|
|
480
|
+
{ deep: true }
|
|
481
|
+
);
|
|
467
482
|
|
|
468
483
|
// Sync URL changes TO the state
|
|
469
484
|
watch(() => route.query, updateStateFromUrl);
|
|
@@ -475,6 +490,7 @@ export function useFacets(allItems, options = {}) {
|
|
|
475
490
|
selectedSort,
|
|
476
491
|
sortTypes,
|
|
477
492
|
displayItems,
|
|
493
|
+
pinnedItems,
|
|
478
494
|
selectedFacets,
|
|
479
495
|
clearFilters,
|
|
480
496
|
handleFacetChange
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ulu/frontend-vue",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.13",
|
|
4
4
|
"description": "A modular and tree-shakeable Vue 3 component library for the Ulu frontend",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -45,7 +45,8 @@
|
|
|
45
45
|
"design-system",
|
|
46
46
|
"ulu",
|
|
47
47
|
"frontend",
|
|
48
|
-
"scss"
|
|
48
|
+
"scss",
|
|
49
|
+
"theme"
|
|
49
50
|
],
|
|
50
51
|
"author": "Joseph Scherben <jscherbe@gmail.com>",
|
|
51
52
|
"license": "MIT",
|