@ulu/frontend-vue 0.2.0-beta.7 → 0.2.0-beta.9
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/utils/UluConditionalWrapper.vue.d.ts.map +1 -1
- package/dist/components/utils/UluConditionalWrapper.vue.js +11 -9
- package/dist/utils/router.d.ts.map +1 -1
- package/dist/utils/router.js +49 -47
- package/lib/components/utils/UluConditionalWrapper.vue +5 -1
- package/lib/utils/router.js +20 -14
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UluConditionalWrapper.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/utils/UluConditionalWrapper.vue"],"names":[],"mappings":"AAQA;
|
|
1
|
+
{"version":3,"file":"UluConditionalWrapper.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/utils/UluConditionalWrapper.vue"],"names":[],"mappings":"AAQA;wBAsHqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAVjC;;;;;;;2OAOG"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { createBlock as
|
|
2
|
-
const
|
|
1
|
+
import { createBlock as a, renderSlot as r, openBlock as n, resolveDynamicComponent as o, normalizeProps as s, mergeProps as l, withCtx as i } from "vue";
|
|
2
|
+
const d = /* @__PURE__ */ Object.assign({
|
|
3
|
+
inheritAttrs: !1
|
|
4
|
+
}, {
|
|
3
5
|
__name: "UluConditionalWrapper",
|
|
4
6
|
props: {
|
|
5
7
|
/**
|
|
@@ -21,15 +23,15 @@ const s = {
|
|
|
21
23
|
default: !1
|
|
22
24
|
}
|
|
23
25
|
},
|
|
24
|
-
setup(
|
|
25
|
-
return (
|
|
26
|
-
default:
|
|
27
|
-
|
|
26
|
+
setup(t) {
|
|
27
|
+
return (e, p) => t.unwrapped ? r(e.$slots, "default", { key: 1 }) : (n(), a(o(t.is), s(l({ key: 0 }, e.$attrs)), {
|
|
28
|
+
default: i(() => [
|
|
29
|
+
r(e.$slots, "default")
|
|
28
30
|
]),
|
|
29
31
|
_: 3
|
|
30
|
-
}));
|
|
32
|
+
}, 16));
|
|
31
33
|
}
|
|
32
|
-
};
|
|
34
|
+
});
|
|
33
35
|
export {
|
|
34
|
-
|
|
36
|
+
d as default
|
|
35
37
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../lib/utils/router.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;GAQG;AACH,qCAJW,MAAM,iBACN,MAAM,GACJ,MAAM,GAAC,SAAS,CAW5B;AAED;;;;;GAKG;AAEH;;;;;;;GAOG;AACH,uCANW,GAAC,WAET;IAAwB,SAAS,EAAzB,MAAM;IACU,IAAI,EAApB,MAAM;CACd,GAAU,KAAK,CAAE,aAAa,CAAC,CAgCjC;AAED;;;;GAIG;AACH,kCAHW,KAAK,CAAC,aAAa,CAAC,GAClB,KAAK,CAAC,aAAa,CAAC,CAgBhC;AAED;;;;;;;;GAQG;AACH,0CAPW,GAAC,eACD,GAAC,WAET;IAAyB,YAAY;IACb,IAAI,EAApB,MAAM;CACd,GAAU,KAAK,CAAE,aAAa,CAAC,CA4BjC;AAED;;;;GAIG;AACH,qDAFa,MAAM,CAIlB;AAED;;;;;;;;GAQG;AACH,sCAPW,MAAM,aACN,MAAM,uBAEd;IAA0B,MAAM;IACN,SAAS;CACnC,GAAU,aAAa,CAuBzB;AAED;;;;GAIG;AACH,qCAHW,MAAM,WAKhB;AAED;;;;GAIG;AACH,yCAHW,MAAM,WAMhB;AAED;;;;GAIG;AACH,yCAHW,MAAM,SACN,MAAM,QAYhB;AAED;;;;GAIG;AACH,yCAHW,MAAM,2BACJ,KAAK,CAAC,MAAM,CAAC,GAAC,SAAS,CAInC;AAED;;;;;GAKG;AACH,uCAJW,MAAM,WACN,MAAM,GACL,MAAM,OAAK,CAUtB;AAUD;;;;;;;;;;GAUG;AACH,0CAPW,MAAM,WAEd;IAAwB,MAAM,EAAtB,MAAM;IACW,YAAY;IACb,IAAI,EAApB,MAAM;CACd,GAAU,KAAK,CAAE,aAAa,CAAC,CAgBjC;AAED;;;;;;;;GAQG;AACH,yCAHW,MAAM,GACJ,KAAK,CAAE;IAAC,KAAK,SAAS;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,UAAS;CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../lib/utils/router.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;GAQG;AACH,qCAJW,MAAM,iBACN,MAAM,GACJ,MAAM,GAAC,SAAS,CAW5B;AAED;;;;;GAKG;AAEH;;;;;;;GAOG;AACH,uCANW,GAAC,WAET;IAAwB,SAAS,EAAzB,MAAM;IACU,IAAI,EAApB,MAAM;CACd,GAAU,KAAK,CAAE,aAAa,CAAC,CAgCjC;AAED;;;;GAIG;AACH,kCAHW,KAAK,CAAC,aAAa,CAAC,GAClB,KAAK,CAAC,aAAa,CAAC,CAgBhC;AAED;;;;;;;;GAQG;AACH,0CAPW,GAAC,eACD,GAAC,WAET;IAAyB,YAAY;IACb,IAAI,EAApB,MAAM;CACd,GAAU,KAAK,CAAE,aAAa,CAAC,CA4BjC;AAED;;;;GAIG;AACH,qDAFa,MAAM,CAIlB;AAED;;;;;;;;GAQG;AACH,sCAPW,MAAM,aACN,MAAM,uBAEd;IAA0B,MAAM;IACN,SAAS;CACnC,GAAU,aAAa,CAuBzB;AAED;;;;GAIG;AACH,qCAHW,MAAM,WAKhB;AAED;;;;GAIG;AACH,yCAHW,MAAM,WAMhB;AAED;;;;GAIG;AACH,yCAHW,MAAM,SACN,MAAM,QAYhB;AAED;;;;GAIG;AACH,yCAHW,MAAM,2BACJ,KAAK,CAAC,MAAM,CAAC,GAAC,SAAS,CAInC;AAED;;;;;GAKG;AACH,uCAJW,MAAM,WACN,MAAM,GACL,MAAM,OAAK,CAUtB;AAUD;;;;;;;;;;GAUG;AACH,0CAPW,MAAM,WAEd;IAAwB,MAAM,EAAtB,MAAM;IACW,YAAY;IACb,IAAI,EAApB,MAAM;CACd,GAAU,KAAK,CAAE,aAAa,CAAC,CAgBjC;AAED;;;;;;;;GAQG;AACH,yCAHW,MAAM,GACJ,KAAK,CAAE;IAAC,KAAK,SAAS;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,UAAS;CAAC,CAAC,CAmCjE"}
|
package/dist/utils/router.js
CHANGED
|
@@ -2,63 +2,63 @@ function m(t, e) {
|
|
|
2
2
|
let n = (t?.meta || {}).title;
|
|
3
3
|
return typeof n == "function" && (n = n(e || t)), n;
|
|
4
4
|
}
|
|
5
|
-
function
|
|
5
|
+
function w(t, e) {
|
|
6
6
|
const n = Object.assign({}, {
|
|
7
|
-
qualifier(
|
|
8
|
-
return
|
|
7
|
+
qualifier(s, c) {
|
|
8
|
+
return c ? b(s) : $(s);
|
|
9
9
|
},
|
|
10
10
|
sort: p,
|
|
11
11
|
item: {},
|
|
12
12
|
includeChildren: !1
|
|
13
|
-
}, e),
|
|
14
|
-
const
|
|
15
|
-
return n.includeChildren &&
|
|
13
|
+
}, e), r = (s, c) => c ? `${c}/${s.path}` : s.path, i = (s, c = null) => s.filter((u) => n.qualifier(u, c)).map((u) => {
|
|
14
|
+
const o = u.children ? g(u.children) : u, h = u.children ? u.children.filter((d) => d.path !== "") : !1, a = f(o, r(u, c), n.item);
|
|
15
|
+
return n.includeChildren && h.length && (a.children = i(h, a.path)), a;
|
|
16
16
|
}).sort(n.sort);
|
|
17
17
|
return i(t);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
function e(
|
|
19
|
+
function j(t) {
|
|
20
|
+
function e(l) {
|
|
21
21
|
const n = [];
|
|
22
|
-
for (const
|
|
23
|
-
const i = { ...
|
|
24
|
-
delete i.children, n.push(i),
|
|
22
|
+
for (const r of l) {
|
|
23
|
+
const i = { ...r };
|
|
24
|
+
delete i.children, n.push(i), r.children && n.push(...e(r.children));
|
|
25
25
|
}
|
|
26
26
|
return n;
|
|
27
27
|
}
|
|
28
28
|
return e(t);
|
|
29
29
|
}
|
|
30
|
-
function O(t, e,
|
|
31
|
-
const
|
|
30
|
+
function O(t, e, l) {
|
|
31
|
+
const r = Object.assign({}, {
|
|
32
32
|
includeIndex: !1,
|
|
33
33
|
item: {},
|
|
34
34
|
sort: p
|
|
35
|
-
},
|
|
36
|
-
if (
|
|
37
|
-
const d =
|
|
35
|
+
}, l), i = t.find((o) => o.path !== "/" && e.includes(o.path)), s = (o, h, a) => {
|
|
36
|
+
if (o.children) {
|
|
37
|
+
const d = o.children.find((x) => x.path.includes(e));
|
|
38
38
|
if (d)
|
|
39
|
-
return
|
|
39
|
+
return s(d, o, a + d.path);
|
|
40
40
|
}
|
|
41
|
-
return { route:
|
|
42
|
-
}, { route:
|
|
43
|
-
return
|
|
41
|
+
return { route: h, path: a };
|
|
42
|
+
}, { route: c, path: u } = s(i, i, i.path);
|
|
43
|
+
return c.children ? c.children.filter(I(r.includeIndex)).map((o) => f(o, `${u}/${o.path}`, r.item)).sort(r.sort) : (console.warn("Unable to build menu for:", e), []);
|
|
44
44
|
}
|
|
45
45
|
function g(t) {
|
|
46
46
|
return t.find((e) => e.path === "");
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
const
|
|
48
|
+
function f(t, e = t.path, l) {
|
|
49
|
+
const r = Object.assign({}, {
|
|
50
50
|
indexMeta: !0,
|
|
51
51
|
modify: null
|
|
52
|
-
},
|
|
52
|
+
}, l);
|
|
53
53
|
let i = Object.assign({}, t.meta);
|
|
54
|
-
|
|
55
|
-
const
|
|
54
|
+
r.indexMeta && t.children && (i = Object.assign({}, i, g(t.children)?.meta));
|
|
55
|
+
const s = { ...t, meta: i }, c = {
|
|
56
56
|
path: e,
|
|
57
|
-
title: m(
|
|
57
|
+
title: m(s, t) || "Missing Title",
|
|
58
58
|
weight: i?.weight || 0,
|
|
59
59
|
meta: i
|
|
60
60
|
};
|
|
61
|
-
return
|
|
61
|
+
return r.modify && r.modify(c, t), c;
|
|
62
62
|
}
|
|
63
63
|
function b(t) {
|
|
64
64
|
return !t.path.includes("/:");
|
|
@@ -68,18 +68,18 @@ function $(t) {
|
|
|
68
68
|
return b(t) && e.length === 1;
|
|
69
69
|
}
|
|
70
70
|
function y(t, e) {
|
|
71
|
-
const { target:
|
|
71
|
+
const { target: l } = e, n = l.closest("a");
|
|
72
72
|
if (n) {
|
|
73
|
-
let
|
|
74
|
-
|
|
73
|
+
let r = n.getAttribute("href");
|
|
74
|
+
r.startsWith("/") && (t.push(r), e.preventDefault());
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
function R(t, e = M(t)) {
|
|
78
78
|
return e?.children;
|
|
79
79
|
}
|
|
80
80
|
function M(t, e) {
|
|
81
|
-
const
|
|
82
|
-
return e ?
|
|
81
|
+
const l = t.matched.length, n = l - 2;
|
|
82
|
+
return e ? l > 1 ? t.matched[0] : null : n < 0 ? null : t.matched[n];
|
|
83
83
|
}
|
|
84
84
|
function I(t) {
|
|
85
85
|
return (e) => t || e.path !== "";
|
|
@@ -93,32 +93,34 @@ function S(t, e) {
|
|
|
93
93
|
includeIndex: !1,
|
|
94
94
|
item: {},
|
|
95
95
|
sort: p
|
|
96
|
-
}, e),
|
|
97
|
-
return (R(t,
|
|
96
|
+
}, e), r = n.parent || M(t);
|
|
97
|
+
return (R(t, r) || []).filter(I(n.includeIndex)).map((s) => f(s, `${r.path}/${s.path}`, n.item)).sort(n.sort);
|
|
98
98
|
}
|
|
99
99
|
function B(t) {
|
|
100
|
-
const { matched: e, path:
|
|
101
|
-
|
|
102
|
-
return e.reduce((i, c, l) => {
|
|
103
|
-
if (c.meta?.breadcrumb === !1 || c.path === n)
|
|
100
|
+
const { matched: e, path: l } = t, n = e.reduce((i, s) => {
|
|
101
|
+
if (s.meta?.breadcrumb === !1)
|
|
104
102
|
return i;
|
|
105
|
-
const
|
|
106
|
-
return i.push(
|
|
107
|
-
title: a,
|
|
108
|
-
to: { path: u ? r : c.path },
|
|
109
|
-
current: u
|
|
110
|
-
}), n = c.path, i;
|
|
103
|
+
const c = i[i.length - 1];
|
|
104
|
+
return c && c.path === s.path || i.push(s), i;
|
|
111
105
|
}, []);
|
|
106
|
+
return n.map((i, s) => {
|
|
107
|
+
const c = s === n.length - 1, u = m(i, t);
|
|
108
|
+
return u || console.warn("Missing route title"), {
|
|
109
|
+
title: u || "Missing Title",
|
|
110
|
+
to: { path: c ? l : i.path },
|
|
111
|
+
current: c
|
|
112
|
+
};
|
|
113
|
+
});
|
|
112
114
|
}
|
|
113
115
|
export {
|
|
114
116
|
B as $createBreadcrumb,
|
|
115
117
|
S as $createSectionMenu,
|
|
116
118
|
M as $getParentRoute,
|
|
117
119
|
R as $getRouteChildren,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
+
w as createBaseMenu,
|
|
121
|
+
f as createMenuItem,
|
|
120
122
|
O as createSectionMenu,
|
|
121
|
-
|
|
123
|
+
j as flattenMenu,
|
|
122
124
|
g as getChildIndexRoute,
|
|
123
125
|
m as getRouteTitle,
|
|
124
126
|
$ as isStaticBaseRoute,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<component v-if="!unwrapped" :is="is">
|
|
2
|
+
<component v-if="!unwrapped" :is="is" v-bind="$attrs">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
</component>
|
|
5
5
|
<template v-else>
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
</template>
|
|
9
9
|
|
|
10
10
|
<script setup>
|
|
11
|
+
defineOptions({
|
|
12
|
+
inheritAttrs: false
|
|
13
|
+
});
|
|
14
|
+
|
|
11
15
|
defineProps({
|
|
12
16
|
/**
|
|
13
17
|
* The underlying component or HTML tag to render.
|
package/lib/utils/router.js
CHANGED
|
@@ -277,29 +277,35 @@ export function $createSectionMenu(route, options) {
|
|
|
277
277
|
*/
|
|
278
278
|
export function $createBreadcrumb(route) {
|
|
279
279
|
const { matched, path: currentPath } = route;
|
|
280
|
-
let prevPath;
|
|
281
280
|
|
|
282
|
-
const
|
|
281
|
+
const filteredMatched = matched.reduce((acc, match) => {
|
|
283
282
|
if (match.meta?.breadcrumb === false) {
|
|
284
|
-
return
|
|
283
|
+
return acc;
|
|
285
284
|
}
|
|
286
285
|
|
|
287
|
-
|
|
288
|
-
|
|
286
|
+
const prevMatch = acc[acc.length - 1];
|
|
287
|
+
if (prevMatch && prevMatch.path === match.path) {
|
|
288
|
+
return acc;
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
-
|
|
292
|
-
|
|
291
|
+
acc.push(match);
|
|
292
|
+
return acc;
|
|
293
|
+
}, []);
|
|
294
|
+
|
|
295
|
+
const crumbs = filteredMatched.map((match, index) => {
|
|
296
|
+
const isLast = index === filteredMatched.length - 1;
|
|
297
|
+
const title = getRouteTitle(match, route);
|
|
298
|
+
|
|
299
|
+
if (!title) {
|
|
300
|
+
console.warn("Missing route title");
|
|
301
|
+
}
|
|
293
302
|
|
|
294
|
-
|
|
295
|
-
title,
|
|
303
|
+
return {
|
|
304
|
+
title: title || "Missing Title",
|
|
296
305
|
to: { path: isLast ? currentPath : match.path },
|
|
297
306
|
current: isLast,
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
prevPath = match.path;
|
|
301
|
-
return arr;
|
|
302
|
-
}, []);
|
|
307
|
+
};
|
|
308
|
+
});
|
|
303
309
|
|
|
304
310
|
return crumbs;
|
|
305
311
|
}
|