@shefing/quickfilter 1.0.32 → 1.0.34
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/README.md +62 -4
- package/dist/QuickFilter.d.ts.map +1 -1
- package/dist/QuickFilter.js +2 -172
- package/dist/QuickFilter.js.map +1 -1
- package/dist/filters/constants/date-filter-options.d.ts +2 -2
- package/dist/filters/constants/date-filter-options.d.ts.map +1 -1
- package/dist/filters/constants/date-filter-options.js +4 -1
- package/dist/filters/constants/date-filter-options.js.map +1 -1
- package/dist/filters/utils/date-helpers.d.ts.map +1 -1
- package/dist/filters/utils/date-helpers.js +26 -0
- package/dist/filters/utils/date-helpers.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/labels.d.ts +38 -2
- package/dist/labels.d.ts.map +1 -1
- package/dist/labels.js +19 -1
- package/dist/labels.js.map +1 -1
- package/dist/lib/utils.d.ts +4 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +186 -0
- package/dist/lib/utils.js.map +1 -1
- package/dist/nav/NavHamburger/index.d.ts +5 -0
- package/dist/nav/NavHamburger/index.d.ts.map +1 -0
- package/dist/nav/NavHamburger/index.js +20 -0
- package/dist/nav/NavHamburger/index.js.map +1 -0
- package/dist/nav/NavWrapper/index.d.ts +7 -0
- package/dist/nav/NavWrapper/index.d.ts.map +1 -0
- package/dist/nav/NavWrapper/index.js +25 -0
- package/dist/nav/NavWrapper/index.js.map +1 -0
- package/dist/nav/NavWrapper/index.scss +27 -0
- package/dist/nav/getNavPrefs.d.ts +3 -0
- package/dist/nav/getNavPrefs.d.ts.map +1 -0
- package/dist/nav/getNavPrefs.js +31 -0
- package/dist/nav/getNavPrefs.js.map +1 -0
- package/dist/nav/index.client.d.ts +8 -0
- package/dist/nav/index.client.d.ts.map +1 -0
- package/dist/nav/index.client.js +93 -0
- package/dist/nav/index.client.js.map +1 -0
- package/dist/nav/index.d.ts +8 -0
- package/dist/nav/index.d.ts.map +1 -0
- package/dist/nav/index.js +208 -0
- package/dist/nav/index.js.map +1 -0
- package/dist/nav/index.scss +163 -0
- package/dist/ui/button.d.ts +1 -1
- package/dist/ui/command.d.ts +7 -7
- package/package.json +6 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/nav/NavHamburger/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAeA,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Hamburger, useNav } from '@payloadcms/ui';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
export const NavHamburger = ({ baseClass })=>{
|
|
6
|
+
const { navOpen, setNavOpen } = useNav();
|
|
7
|
+
return /*#__PURE__*/ _jsx("button", {
|
|
8
|
+
className: `${baseClass}__mobile-close`,
|
|
9
|
+
onClick: ()=>{
|
|
10
|
+
setNavOpen(false);
|
|
11
|
+
},
|
|
12
|
+
tabIndex: !navOpen ? -1 : undefined,
|
|
13
|
+
type: "button",
|
|
14
|
+
children: /*#__PURE__*/ _jsx(Hamburger, {
|
|
15
|
+
isActive: true
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/nav/NavHamburger/index.tsx"],"sourcesContent":["'use client'\nimport { Hamburger, useNav } from '@payloadcms/ui'\nimport React from 'react'\n\nexport const NavHamburger: React.FC<{\n baseClass?: string\n}> = ({ baseClass }) => {\n const { navOpen, setNavOpen } = useNav()\n\n return (\n <button\n className={`${baseClass}__mobile-close`}\n onClick={() => {\n setNavOpen(false)\n }}\n tabIndex={!navOpen ? -1 : undefined}\n type=\"button\"\n >\n <Hamburger isActive />\n </button>\n )\n}\n"],"names":["Hamburger","useNav","React","NavHamburger","baseClass","navOpen","setNavOpen","button","className","onClick","tabIndex","undefined","type","isActive"],"mappings":"AAAA;;AACA,SAASA,SAAS,EAAEC,MAAM,QAAQ,iBAAgB;AAClD,OAAOC,WAAW,QAAO;AAEzB,OAAO,MAAMC,eAER,CAAC,EAAEC,SAAS,EAAE;IACjB,MAAM,EAAEC,OAAO,EAAEC,UAAU,EAAE,GAAGL;IAEhC,qBACE,KAACM;QACCC,WAAW,GAAGJ,UAAU,cAAc,CAAC;QACvCK,SAAS;YACPH,WAAW;QACb;QACAI,UAAU,CAACL,UAAU,CAAC,IAAIM;QAC1BC,MAAK;kBAEL,cAAA,KAACZ;YAAUa,QAAQ;;;AAGzB,EAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/nav/NavWrapper/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,cAAc,CAAA;AAErB,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CAsBA,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useNav } from '@payloadcms/ui';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import './index.scss';
|
|
6
|
+
export const NavWrapper = (props)=>{
|
|
7
|
+
const { baseClass, children } = props;
|
|
8
|
+
const { hydrated, navOpen, navRef, shouldAnimate } = useNav();
|
|
9
|
+
return /*#__PURE__*/ _jsx("aside", {
|
|
10
|
+
className: [
|
|
11
|
+
baseClass,
|
|
12
|
+
navOpen && `${baseClass}--nav-open`,
|
|
13
|
+
shouldAnimate && `${baseClass}--nav-animate`,
|
|
14
|
+
hydrated && `${baseClass}--nav-hydrated`
|
|
15
|
+
].filter(Boolean).join(' '),
|
|
16
|
+
inert: !navOpen ? true : undefined,
|
|
17
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
18
|
+
className: `${baseClass}__scroll`,
|
|
19
|
+
ref: navRef,
|
|
20
|
+
children: children
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/nav/NavWrapper/index.tsx"],"sourcesContent":["'use client'\nimport { useNav } from '@payloadcms/ui'\nimport React from 'react'\n\nimport './index.scss'\n\nexport const NavWrapper: React.FC<{\n baseClass?: string\n children: React.ReactNode\n}> = (props) => {\n const { baseClass, children } = props\n\n const { hydrated, navOpen, navRef, shouldAnimate } = useNav()\n\n return (\n <aside\n className={[\n baseClass,\n navOpen && `${baseClass}--nav-open`,\n shouldAnimate && `${baseClass}--nav-animate`,\n hydrated && `${baseClass}--nav-hydrated`,\n ]\n .filter(Boolean)\n .join(' ')}\n inert={!navOpen ? true : undefined}\n >\n <div className={`${baseClass}__scroll`} ref={navRef}>\n {children}\n </div>\n </aside>\n )\n}\n"],"names":["useNav","React","NavWrapper","props","baseClass","children","hydrated","navOpen","navRef","shouldAnimate","aside","className","filter","Boolean","join","inert","undefined","div","ref"],"mappings":"AAAA;;AACA,SAASA,MAAM,QAAQ,iBAAgB;AACvC,OAAOC,WAAW,QAAO;AAEzB,OAAO,eAAc;AAErB,OAAO,MAAMC,aAGR,CAACC;IACJ,MAAM,EAAEC,SAAS,EAAEC,QAAQ,EAAE,GAAGF;IAEhC,MAAM,EAAEG,QAAQ,EAAEC,OAAO,EAAEC,MAAM,EAAEC,aAAa,EAAE,GAAGT;IAErD,qBACE,KAACU;QACCC,WAAW;YACTP;YACAG,WAAW,GAAGH,UAAU,UAAU,CAAC;YACnCK,iBAAiB,GAAGL,UAAU,aAAa,CAAC;YAC5CE,YAAY,GAAGF,UAAU,cAAc,CAAC;SACzC,CACEQ,MAAM,CAACC,SACPC,IAAI,CAAC;QACRC,OAAO,CAACR,UAAU,OAAOS;kBAEzB,cAAA,KAACC;YAAIN,WAAW,GAAGP,UAAU,QAAQ,CAAC;YAAEc,KAAKV;sBAC1CH;;;AAIT,EAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@import '~@payloadcms/ui/scss';
|
|
2
|
+
|
|
3
|
+
@layer payload-default {
|
|
4
|
+
.nav {
|
|
5
|
+
position: sticky;
|
|
6
|
+
top: 0;
|
|
7
|
+
left: 0;
|
|
8
|
+
flex-shrink: 0;
|
|
9
|
+
height: 100vh;
|
|
10
|
+
width: var(--nav-width);
|
|
11
|
+
border-right: 1px solid var(--theme-elevation-100);
|
|
12
|
+
opacity: 0;
|
|
13
|
+
|
|
14
|
+
[dir='rtl'] & {
|
|
15
|
+
border-right: none;
|
|
16
|
+
border-left: 1px solid var(--theme-elevation-100);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&--nav-animate {
|
|
20
|
+
transition: opacity var(--nav-trans-time) ease-in-out;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&--nav-open {
|
|
24
|
+
opacity: 1;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getNavPrefs.d.ts","sourceRoot":"","sources":["../../src/nav/getNavPrefs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAI7D,eAAO,MAAM,WAAW,QAAqB,cAAc,KAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAgCzF,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { cache } from 'react';
|
|
2
|
+
export const getNavPrefs = cache(async (req)=>{
|
|
3
|
+
return req?.user?.collection ? await req.payload.find({
|
|
4
|
+
collection: 'payload-preferences',
|
|
5
|
+
depth: 0,
|
|
6
|
+
limit: 1,
|
|
7
|
+
pagination: false,
|
|
8
|
+
req,
|
|
9
|
+
where: {
|
|
10
|
+
and: [
|
|
11
|
+
{
|
|
12
|
+
key: {
|
|
13
|
+
equals: 'nav'
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
'user.relationTo': {
|
|
18
|
+
equals: req.user.collection
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
'user.value': {
|
|
23
|
+
equals: req?.user?.id
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
})?.then((res)=>res?.docs?.[0]?.value) : null;
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=getNavPrefs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/nav/getNavPrefs.ts"],"sourcesContent":["import type { NavPreferences, PayloadRequest } from 'payload'\n\nimport { cache } from 'react'\n\nexport const getNavPrefs = cache(async (req: PayloadRequest): Promise<NavPreferences | null\n> => {\n return req?.user?.collection\n ? await req.payload\n .find({\n collection: 'payload-preferences',\n depth: 0,\n limit: 1,\n pagination: false,\n req,\n where: {\n and: [\n {\n key: {\n equals: 'nav',\n },\n },\n {\n 'user.relationTo': {\n equals: req.user.collection,\n },\n },\n {\n 'user.value': {\n equals: req?.user?.id,\n },\n },\n ],\n },\n })\n ?.then((res) => res?.docs?.[0]?.value as NavPreferences)\n : null\n})\n"],"names":["cache","getNavPrefs","req","user","collection","payload","find","depth","limit","pagination","where","and","key","equals","id","then","res","docs","value"],"mappings":"AAEA,SAASA,KAAK,QAAQ,QAAO;AAE7B,OAAO,MAAMC,cAAcD,MAAM,OAAOE;IAEtC,OAAOA,KAAKC,MAAMC,aACd,MAAMF,IAAIG,OAAO,CACdC,IAAI,CAAC;QACJF,YAAY;QACZG,OAAO;QACPC,OAAO;QACPC,YAAY;QACZP;QACAQ,OAAO;YACLC,KAAK;gBACH;oBACEC,KAAK;wBACHC,QAAQ;oBACV;gBACF;gBACA;oBACE,mBAAmB;wBACjBA,QAAQX,IAAIC,IAAI,CAACC,UAAU;oBAC7B;gBACF;gBACA;oBACE,cAAc;wBACZS,QAAQX,KAAKC,MAAMW;oBACrB;gBACF;aACD;QACH;IACF,IACEC,KAAK,CAACC,MAAQA,KAAKC,MAAM,CAAC,EAAE,EAAEC,SAClC;AACN,GAAE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { groupNavItems } from '@payloadcms/ui/shared';
|
|
2
|
+
import type { NavPreferences } from 'payload';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export declare const DefaultNavClient: React.FC<{
|
|
5
|
+
groups: ReturnType<typeof groupNavItems>;
|
|
6
|
+
navPreferences: NavPreferences;
|
|
7
|
+
}>;
|
|
8
|
+
//# sourceMappingURL=index.client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../src/nav/index.client.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,SAAS,CAAA;AAgB1D,OAAO,KAAmB,MAAM,OAAO,CAAA;AAIvC,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC;IACtC,MAAM,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAA;IACxC,cAAc,EAAE,cAAc,CAAA;CAC/B,CA6EA,CAAA"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { getTranslation } from '@payloadcms/translations';
|
|
4
|
+
import { BrowseByFolderButton, Link, NavGroup, useConfig, useTranslation } from '@payloadcms/ui';
|
|
5
|
+
import { EntityType } from '@payloadcms/ui/shared';
|
|
6
|
+
import { usePathname } from 'next/navigation.js';
|
|
7
|
+
import { formatAdminURL } from 'payload/shared';
|
|
8
|
+
import React, { Fragment } from 'react';
|
|
9
|
+
const baseClass = 'nav';
|
|
10
|
+
export const DefaultNavClient = ({ groups, navPreferences })=>{
|
|
11
|
+
const pathname = usePathname();
|
|
12
|
+
const { config } = useConfig();
|
|
13
|
+
const { i18n } = useTranslation();
|
|
14
|
+
const folderURL = formatAdminURL({
|
|
15
|
+
adminRoute: config.routes.admin,
|
|
16
|
+
path: config.admin.routes.browseByFolder
|
|
17
|
+
});
|
|
18
|
+
const viewingRootFolderView = pathname.startsWith(folderURL);
|
|
19
|
+
return /*#__PURE__*/ _jsxs(Fragment, {
|
|
20
|
+
children: [
|
|
21
|
+
config.folders && config.folders.browseByFolder && /*#__PURE__*/ _jsx(BrowseByFolderButton, {
|
|
22
|
+
active: viewingRootFolderView
|
|
23
|
+
}),
|
|
24
|
+
groups.map(({ entities, label }, key)=>{
|
|
25
|
+
return /*#__PURE__*/ _jsx(NavGroup, {
|
|
26
|
+
isOpen: navPreferences?.groups?.[label]?.open,
|
|
27
|
+
label: label,
|
|
28
|
+
children: entities.map(({ slug, type, label, href: entityHref }, i)=>{
|
|
29
|
+
let href = entityHref || "";
|
|
30
|
+
let id = "";
|
|
31
|
+
// If href is not provided from the server component, calculate it here
|
|
32
|
+
if (!href) {
|
|
33
|
+
if (type === EntityType.collection) {
|
|
34
|
+
href = formatAdminURL({
|
|
35
|
+
adminRoute: config.routes.admin,
|
|
36
|
+
path: `/collections/${slug}`
|
|
37
|
+
});
|
|
38
|
+
id = `nav-${slug}`;
|
|
39
|
+
}
|
|
40
|
+
if (type === EntityType.global) {
|
|
41
|
+
href = formatAdminURL({
|
|
42
|
+
adminRoute: config.routes.admin,
|
|
43
|
+
path: `/globals/${slug}`
|
|
44
|
+
});
|
|
45
|
+
id = `nav-global-${slug}`;
|
|
46
|
+
}
|
|
47
|
+
} else {
|
|
48
|
+
// If href is provided, still set the id
|
|
49
|
+
if (type === EntityType.collection) {
|
|
50
|
+
id = `nav-${slug}`;
|
|
51
|
+
}
|
|
52
|
+
if (type === EntityType.global) {
|
|
53
|
+
id = `nav-global-${slug}`;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const isActive = pathname.startsWith(href) && [
|
|
57
|
+
'/',
|
|
58
|
+
undefined
|
|
59
|
+
].includes(pathname[href.length]);
|
|
60
|
+
const Label = /*#__PURE__*/ _jsxs(_Fragment, {
|
|
61
|
+
children: [
|
|
62
|
+
isActive && /*#__PURE__*/ _jsx("div", {
|
|
63
|
+
className: `${baseClass}__link-indicator`
|
|
64
|
+
}),
|
|
65
|
+
/*#__PURE__*/ _jsx("span", {
|
|
66
|
+
className: `${baseClass}__link-label`,
|
|
67
|
+
children: getTranslation(label, i18n)
|
|
68
|
+
})
|
|
69
|
+
]
|
|
70
|
+
});
|
|
71
|
+
// If the URL matches the link exactly
|
|
72
|
+
if (pathname === href) {
|
|
73
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
74
|
+
className: `${baseClass}__link`,
|
|
75
|
+
id: id,
|
|
76
|
+
children: Label
|
|
77
|
+
}, i);
|
|
78
|
+
}
|
|
79
|
+
return /*#__PURE__*/ _jsx(Link, {
|
|
80
|
+
className: `${baseClass}__link`,
|
|
81
|
+
href: href,
|
|
82
|
+
id: id,
|
|
83
|
+
prefetch: false,
|
|
84
|
+
children: Label
|
|
85
|
+
}, i);
|
|
86
|
+
})
|
|
87
|
+
}, key);
|
|
88
|
+
})
|
|
89
|
+
]
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
//# sourceMappingURL=index.client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/nav/index.client.tsx"],"sourcesContent":["'use client'\n\nimport type { groupNavItems } from '@payloadcms/ui/shared'\nimport type { NavPreferences, StaticLabel } from 'payload'\n\n// Extend the Entity type to include the href property\ntype EntityWithHref = {\n label: StaticLabel;\n slug: string;\n type: EntityType;\n href?: string;\n};\n\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { BrowseByFolderButton, Link, NavGroup, useConfig, useTranslation } from '@payloadcms/ui'\nimport { EntityType } from '@payloadcms/ui/shared'\nimport { usePathname } from 'next/navigation.js'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { Fragment } from 'react'\n\nconst baseClass = 'nav'\n\nexport const DefaultNavClient: React.FC<{\n groups: ReturnType<typeof groupNavItems>\n navPreferences: NavPreferences\n}> = ({ groups, navPreferences }) => {\n const pathname = usePathname()\n\n const {\n config,\n } = useConfig()\n\n const { i18n } = useTranslation()\n\n const folderURL = formatAdminURL({\n adminRoute: config.routes.admin,\n path: config.admin.routes.browseByFolder,\n })\n\n const viewingRootFolderView = pathname.startsWith(folderURL)\n\n return (\n <Fragment>\n {config.folders && config.folders.browseByFolder && <BrowseByFolderButton active={viewingRootFolderView} />}\n {groups.map(({ entities, label }, key) => {\n return (\n <NavGroup isOpen={navPreferences?.groups?.[label]?.open} key={key} label={label}>\n {entities.map(({ slug, type, label, href: entityHref }: EntityWithHref, i) => {\n let href: string = entityHref || \"\"\n let id: string = \"\"\n\n // If href is not provided from the server component, calculate it here\n if (!href) {\n if (type === EntityType.collection) {\n href = formatAdminURL({ adminRoute: config.routes.admin, path: `/collections/${slug}` })\n id = `nav-${slug}`\n }\n\n if (type === EntityType.global) {\n href = formatAdminURL({ adminRoute: config.routes.admin, path: `/globals/${slug}` })\n id = `nav-global-${slug}`\n }\n } else {\n // If href is provided, still set the id\n if (type === EntityType.collection) {\n id = `nav-${slug}`\n }\n if (type === EntityType.global) {\n id = `nav-global-${slug}`\n }\n }\n\n const isActive =\n pathname.startsWith(href) && ['/', undefined].includes(pathname[href.length])\n\n const Label = (\n <>\n {isActive && <div className={`${baseClass}__link-indicator`} />}\n <span className={`${baseClass}__link-label`}>{getTranslation(label, i18n)}</span>\n </>\n )\n\n // If the URL matches the link exactly\n if (pathname === href) {\n return (\n <div className={`${baseClass}__link`} id={id} key={i}>\n {Label}\n </div>\n )\n }\n\n return (\n <Link className={`${baseClass}__link`} href={href} id={id} key={i} prefetch={false}>\n {Label}\n </Link>\n )\n })}\n </NavGroup>\n )\n })}\n </Fragment>\n )\n}\n"],"names":["getTranslation","BrowseByFolderButton","Link","NavGroup","useConfig","useTranslation","EntityType","usePathname","formatAdminURL","React","Fragment","baseClass","DefaultNavClient","groups","navPreferences","pathname","config","i18n","folderURL","adminRoute","routes","admin","path","browseByFolder","viewingRootFolderView","startsWith","folders","active","map","entities","label","key","isOpen","open","slug","type","href","entityHref","i","id","collection","global","isActive","undefined","includes","length","Label","div","className","span","prefetch"],"mappings":"AAAA;;AAcA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,SAASC,oBAAoB,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,cAAc,QAAQ,iBAAgB;AAChG,SAASC,UAAU,QAAQ,wBAAuB;AAClD,SAASC,WAAW,QAAQ,qBAAoB;AAChD,SAASC,cAAc,QAAQ,iBAAgB;AAC/C,OAAOC,SAASC,QAAQ,QAAQ,QAAO;AAEvC,MAAMC,YAAY;AAElB,OAAO,MAAMC,mBAGR,CAAC,EAAEC,MAAM,EAAEC,cAAc,EAAE;IAC9B,MAAMC,WAAWR;IAEjB,MAAM,EACJS,MAAM,EACP,GAAGZ;IAEJ,MAAM,EAAEa,IAAI,EAAE,GAAGZ;IAEjB,MAAMa,YAAYV,eAAe;QAC/BW,YAAYH,OAAOI,MAAM,CAACC,KAAK;QAC/BC,MAAMN,OAAOK,KAAK,CAACD,MAAM,CAACG,cAAc;IAC1C;IAEA,MAAMC,wBAAwBT,SAASU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,MAAMC,sBACJ;;gCACGJ,0BAAY,KAACK;oCAAIC,WAAW,GAAGrC,UAAU,gBAAgB,CAAC;;8CAC3D,KAACsC;oCAAKD,WAAW,GAAGrC,UAAU,YAAY,CAAC;8CAAGX,eAAe8B,OAAOb;;;;wBAIxE,sCAAsC;wBACtC,IAAIF,aAAaqB,MAAM;4BACrB,qBACE,KAACW;gCAAIC,WAAW,GAAGrC,UAAU,MAAM,CAAC;gCAAE4B,IAAIA;0CACvCO;+BADgDR;wBAIvD;wBAEA,qBACE,KAACpC;4BAAK8C,WAAW,GAAGrC,UAAU,MAAM,CAAC;4BAAEyB,MAAMA;4BAAMG,IAAIA;4BAAYW,UAAU;sCAC1EJ;2BAD6DR;oBAIpE;mBAlD4DP;YAqDlE;;;AAGN,EAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PayloadRequest, ServerProps } from 'payload';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export type NavProps = {
|
|
4
|
+
req?: PayloadRequest;
|
|
5
|
+
} & ServerProps;
|
|
6
|
+
export declare const NavDefaultFilter: React.FC<NavProps>;
|
|
7
|
+
export default NavDefaultFilter;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/nav/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,cAAc,EAGd,WAAW,EAEZ,MAAM,SAAS,CAAA;AAKhB,OAAO,KAAK,MAAM,OAAO,CAAA;AAmEzB,MAAM,MAAM,QAAQ,GAAG;IACrB,GAAG,CAAC,EAAE,cAAc,CAAA;CACrB,GAAG,WAAW,CAAA;AAEf,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,CA2L/C,CAAA;AACD,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Logout } from '@payloadcms/ui';
|
|
3
|
+
import { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent';
|
|
4
|
+
import { EntityType, groupNavItems } from '@payloadcms/ui/shared';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { formatAdminURL } from 'payload/shared';
|
|
7
|
+
import { parseWhereClauseToFilterValues, buildQuickFilterConditions } from '../lib/utils';
|
|
8
|
+
import { stringify } from 'qs-esm';
|
|
9
|
+
import { NavHamburger } from './NavHamburger';
|
|
10
|
+
import { NavWrapper } from './NavWrapper';
|
|
11
|
+
// Import SCSS only in browser environment
|
|
12
|
+
// This prevents Node.js from trying to import SCSS directly
|
|
13
|
+
// which causes ERR_UNKNOWN_FILE_EXTENSION error
|
|
14
|
+
if (typeof window !== 'undefined') {
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
import('./index.scss').catch((err)=>{
|
|
17
|
+
console.warn('Failed to load SCSS file:', err);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
const baseClass = 'nav';
|
|
21
|
+
import { getNavPrefs } from './getNavPrefs';
|
|
22
|
+
import { DefaultNavClient } from './index.client';
|
|
23
|
+
// Recursive function to find a field by name
|
|
24
|
+
function findFieldByName(fields, fieldName) {
|
|
25
|
+
// First check at the current level
|
|
26
|
+
const directMatch = fields.find((f)=>f.name === fieldName);
|
|
27
|
+
if (directMatch) return directMatch;
|
|
28
|
+
// If not found, search recursively in nested structures
|
|
29
|
+
for (const item of fields){
|
|
30
|
+
// Check in array, row, or collapsible fields
|
|
31
|
+
if ((item.type === 'array' || item.type === 'row' || item.type === 'collapsible') && 'fields' in item && Array.isArray(item.fields)) {
|
|
32
|
+
const nestedMatch = findFieldByName(item.fields, fieldName);
|
|
33
|
+
if (nestedMatch) return nestedMatch;
|
|
34
|
+
} else if (item.type === 'tabs' && Array.isArray(item.tabs)) {
|
|
35
|
+
for (const tab of item.tabs){
|
|
36
|
+
if ('fields' in tab && Array.isArray(tab.fields)) {
|
|
37
|
+
const tabMatch = findFieldByName(tab.fields, fieldName);
|
|
38
|
+
if (tabMatch) return tabMatch;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
} else if (item.type === 'blocks' && Array.isArray(item.blocks)) {
|
|
42
|
+
for (const block of item.blocks){
|
|
43
|
+
if ('fields' in block && Array.isArray(block.fields)) {
|
|
44
|
+
const blockMatch = findFieldByName(block.fields, fieldName);
|
|
45
|
+
if (blockMatch) return blockMatch;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
export const NavDefaultFilter = async (props)=>{
|
|
53
|
+
const { documentSubViewType, i18n, locale, params, payload, permissions, req, searchParams, user, viewType, visibleEntities } = props;
|
|
54
|
+
if (!payload?.config) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
const { admin: { components: { afterNavLinks, beforeNavLinks, logout } }, collections, globals } = payload.config;
|
|
58
|
+
const groups = groupNavItems([
|
|
59
|
+
...collections.filter(({ slug })=>visibleEntities?.collections.includes(slug)).map((collection)=>({
|
|
60
|
+
type: EntityType.collection,
|
|
61
|
+
entity: collection
|
|
62
|
+
})),
|
|
63
|
+
...globals.filter(({ slug })=>visibleEntities?.globals.includes(slug)).map((global)=>({
|
|
64
|
+
type: EntityType.global,
|
|
65
|
+
entity: global
|
|
66
|
+
}))
|
|
67
|
+
], permissions, i18n);
|
|
68
|
+
const navPreferences = await getNavPrefs(req);
|
|
69
|
+
// Process collections to calculate URLs with defaultFilter
|
|
70
|
+
const processedGroups = groups.map((group)=>{
|
|
71
|
+
const processedEntities = group.entities.map((entity)=>{
|
|
72
|
+
if (entity.type === EntityType.collection) {
|
|
73
|
+
const collection = collections.find((c)=>c.slug === entity.slug);
|
|
74
|
+
debugger;
|
|
75
|
+
// Check if collection has defaultFilter in custom props
|
|
76
|
+
if (collection?.custom?.defaultFilter) {
|
|
77
|
+
// Base URL without query parameters
|
|
78
|
+
const baseHref = formatAdminURL({
|
|
79
|
+
adminRoute: payload.config.routes.admin,
|
|
80
|
+
path: `/collections/${entity.slug}`
|
|
81
|
+
});
|
|
82
|
+
// Get the fields from the collection for parsing the where clause
|
|
83
|
+
const fields = collection.custom.filterList?.flat().map((field)=>{
|
|
84
|
+
const fieldName = field.name;
|
|
85
|
+
const fieldConfig = findFieldByName(collection.fields, fieldName);
|
|
86
|
+
return {
|
|
87
|
+
name: fieldName,
|
|
88
|
+
type: fieldConfig?.type,
|
|
89
|
+
options: fieldConfig?.options,
|
|
90
|
+
label: fieldConfig?.label || fieldName,
|
|
91
|
+
row: 0,
|
|
92
|
+
width: typeof field === 'object' && 'width' in field ? field.width : undefined
|
|
93
|
+
};
|
|
94
|
+
}).filter(Boolean) || [];
|
|
95
|
+
// If we have fields and a defaultFilter, calculate the URL with where clause
|
|
96
|
+
if (fields.length > 0) {
|
|
97
|
+
// Parse the defaultFilter to get filter values
|
|
98
|
+
const filterValues = parseWhereClauseToFilterValues(collection.custom.defaultFilter, fields, i18n.language);
|
|
99
|
+
// If we have filter values, add them to the URL
|
|
100
|
+
if (Object.keys(filterValues).length > 0) {
|
|
101
|
+
const quickFilterConditions = buildQuickFilterConditions(filterValues, fields, i18n.language);
|
|
102
|
+
const whereCondition = quickFilterConditions.length === 1 ? quickFilterConditions[0] : {
|
|
103
|
+
and: quickFilterConditions
|
|
104
|
+
};
|
|
105
|
+
const query = {
|
|
106
|
+
where: whereCondition
|
|
107
|
+
};
|
|
108
|
+
const stringifiedQuery = stringify(query, {
|
|
109
|
+
addQueryPrefix: true
|
|
110
|
+
});
|
|
111
|
+
return {
|
|
112
|
+
...entity,
|
|
113
|
+
href: `${baseHref}${stringifiedQuery}`
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return entity;
|
|
120
|
+
});
|
|
121
|
+
return {
|
|
122
|
+
...group,
|
|
123
|
+
entities: processedEntities
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
const LogoutComponent = RenderServerComponent({
|
|
127
|
+
clientProps: {
|
|
128
|
+
documentSubViewType,
|
|
129
|
+
viewType
|
|
130
|
+
},
|
|
131
|
+
Component: logout?.Button,
|
|
132
|
+
Fallback: Logout,
|
|
133
|
+
importMap: payload.importMap,
|
|
134
|
+
serverProps: {
|
|
135
|
+
i18n,
|
|
136
|
+
locale,
|
|
137
|
+
params,
|
|
138
|
+
payload,
|
|
139
|
+
permissions,
|
|
140
|
+
searchParams,
|
|
141
|
+
user
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
return /*#__PURE__*/ _jsxs(NavWrapper, {
|
|
145
|
+
baseClass: baseClass,
|
|
146
|
+
children: [
|
|
147
|
+
/*#__PURE__*/ _jsxs("nav", {
|
|
148
|
+
className: `${baseClass}__wrap`,
|
|
149
|
+
children: [
|
|
150
|
+
RenderServerComponent({
|
|
151
|
+
clientProps: {
|
|
152
|
+
documentSubViewType,
|
|
153
|
+
viewType
|
|
154
|
+
},
|
|
155
|
+
Component: beforeNavLinks,
|
|
156
|
+
importMap: payload.importMap,
|
|
157
|
+
serverProps: {
|
|
158
|
+
i18n,
|
|
159
|
+
locale,
|
|
160
|
+
params,
|
|
161
|
+
payload,
|
|
162
|
+
permissions,
|
|
163
|
+
searchParams,
|
|
164
|
+
user
|
|
165
|
+
}
|
|
166
|
+
}),
|
|
167
|
+
/*#__PURE__*/ _jsx(DefaultNavClient, {
|
|
168
|
+
groups: processedGroups,
|
|
169
|
+
navPreferences: navPreferences
|
|
170
|
+
}),
|
|
171
|
+
RenderServerComponent({
|
|
172
|
+
clientProps: {
|
|
173
|
+
documentSubViewType,
|
|
174
|
+
viewType
|
|
175
|
+
},
|
|
176
|
+
Component: afterNavLinks,
|
|
177
|
+
importMap: payload.importMap,
|
|
178
|
+
serverProps: {
|
|
179
|
+
i18n,
|
|
180
|
+
locale,
|
|
181
|
+
params,
|
|
182
|
+
payload,
|
|
183
|
+
permissions,
|
|
184
|
+
searchParams,
|
|
185
|
+
user
|
|
186
|
+
}
|
|
187
|
+
}),
|
|
188
|
+
/*#__PURE__*/ _jsx("div", {
|
|
189
|
+
className: `${baseClass}__controls`,
|
|
190
|
+
children: LogoutComponent
|
|
191
|
+
})
|
|
192
|
+
]
|
|
193
|
+
}),
|
|
194
|
+
/*#__PURE__*/ _jsx("div", {
|
|
195
|
+
className: `${baseClass}__header`,
|
|
196
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
197
|
+
className: `${baseClass}__header-content`,
|
|
198
|
+
children: /*#__PURE__*/ _jsx(NavHamburger, {
|
|
199
|
+
baseClass: baseClass
|
|
200
|
+
})
|
|
201
|
+
})
|
|
202
|
+
})
|
|
203
|
+
]
|
|
204
|
+
});
|
|
205
|
+
};
|
|
206
|
+
export default NavDefaultFilter;
|
|
207
|
+
|
|
208
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/nav/index.tsx"],"sourcesContent":["import type { EntityToGroup } from '@payloadcms/ui/shared'\nimport type {\n Field,\n NavPreferences,\n PayloadRequest,\n SanitizedPermissions,\n SelectField,\n ServerProps,\n UIField,\n} from 'payload'\n\nimport { Logout } from '@payloadcms/ui'\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { EntityType, groupNavItems } from '@payloadcms/ui/shared'\nimport React from 'react'\nimport { formatAdminURL } from 'payload/shared'\nimport { parseWhereClauseToFilterValues, buildQuickFilterConditions } from '../lib/utils'\nimport type { FilterDetaild } from '../filters/types/filters-type'\nimport type { SupportedLocale } from '../labels'\nimport { stringify } from 'qs-esm'\n\nimport { NavHamburger } from './NavHamburger'\nimport { NavWrapper } from './NavWrapper'\n// Import SCSS only in browser environment\n// This prevents Node.js from trying to import SCSS directly\n// which causes ERR_UNKNOWN_FILE_EXTENSION error\nif (typeof window !== 'undefined') {\n // @ts-ignore\n import('./index.scss').catch(err => {\n console.warn('Failed to load SCSS file:', err);\n });\n}\n\nconst baseClass = 'nav'\n\nimport { getNavPrefs } from './getNavPrefs'\nimport { DefaultNavClient } from './index.client'\nimport { FieldAffectingData } from 'payload'\n\n// Recursive function to find a field by name\nfunction findFieldByName(fields: Field[], fieldName: string): Field {\n // First check at the current level\n const directMatch = fields.find(\n (f) => (f as FieldAffectingData).name === fieldName,\n )\n if (directMatch) return directMatch\n\n // If not found, search recursively in nested structures\n for (const item of fields) {\n // Check in array, row, or collapsible fields\n if (\n (item.type === 'array' || item.type === 'row' || item.type === 'collapsible') &&\n 'fields' in item &&\n Array.isArray(item.fields)\n ) {\n const nestedMatch = findFieldByName(item.fields, fieldName)\n if (nestedMatch) return nestedMatch\n } \n // Check in tabs\n else if (item.type === 'tabs' && Array.isArray(item.tabs)) {\n for (const tab of item.tabs) {\n if ('fields' in tab && Array.isArray(tab.fields)) {\n const tabMatch = findFieldByName(tab.fields, fieldName)\n if (tabMatch) return tabMatch\n }\n }\n } \n // Check in blocks\n else if (item.type === 'blocks' && Array.isArray(item.blocks)) {\n for (const block of item.blocks) {\n if ('fields' in block && Array.isArray(block.fields)) {\n const blockMatch = findFieldByName(block.fields, fieldName)\n if (blockMatch) return blockMatch\n }\n }\n }\n }\n\n return null\n}\n\nexport type NavProps = {\n req?: PayloadRequest\n} & ServerProps\n\nexport const NavDefaultFilter: React.FC<NavProps> = async (props) => {\n const {\n documentSubViewType,\n i18n,\n locale,\n params,\n payload,\n permissions,\n req,\n searchParams,\n user,\n viewType,\n visibleEntities,\n } = props\n\n if (!payload?.config) {\n return null\n }\n\n const {\n admin: {\n components: { afterNavLinks, beforeNavLinks, logout },\n },\n collections,\n globals,\n } = payload.config\n\n const groups = groupNavItems(\n [\n ...collections\n .filter(({ slug }) => visibleEntities?.collections.includes(slug))\n .map(\n (collection) =>\n ({\n type: EntityType.collection,\n entity: collection,\n }) satisfies EntityToGroup,\n ),\n ...globals\n .filter(({ slug }) => visibleEntities?.globals.includes(slug))\n .map(\n (global) =>\n ({\n type: EntityType.global,\n entity: global,\n }) satisfies EntityToGroup,\n ),\n ],\n permissions as SanitizedPermissions,\n i18n,\n )\n\n const navPreferences = await getNavPrefs(req as PayloadRequest)\n\n // Process collections to calculate URLs with defaultFilter\n const processedGroups = groups.map(group => {\n const processedEntities = group.entities.map(entity => {\n if (entity.type === EntityType.collection) {\n const collection = collections.find(c => c.slug === entity.slug);\n debugger\n // Check if collection has defaultFilter in custom props\n if (collection?.custom?.defaultFilter) {\n // Base URL without query parameters\n const baseHref = formatAdminURL({ \n adminRoute: payload.config.routes.admin, \n path: `/collections/${entity.slug}` \n });\n\n // Get the fields from the collection for parsing the where clause\n const fields: FilterDetaild[] =\n collection.custom.filterList\n ?.flat()\n .map((field: { name: string; width: string | undefined }) => {\n const fieldName = field.name\n const fieldConfig = findFieldByName(collection.fields, fieldName)\n return {\n name: fieldName,\n type: fieldConfig?.type,\n options: (fieldConfig as SelectField )?.options,\n label: (fieldConfig as UIField)?.label || fieldName,\n row: 0,\n width: typeof field === 'object' && 'width' in field ? field.width : undefined,\n } as FilterDetaild\n })\n .filter(Boolean) || []\n\n // If we have fields and a defaultFilter, calculate the URL with where clause\n if (fields.length > 0) {\n // Parse the defaultFilter to get filter values\n const filterValues = parseWhereClauseToFilterValues(\n collection.custom.defaultFilter,\n fields,\n i18n.language as SupportedLocale\n );\n // If we have filter values, add them to the URL\n if (Object.keys(filterValues).length > 0) {\n const quickFilterConditions = buildQuickFilterConditions(filterValues, fields, i18n.language as SupportedLocale)\n\n\n const whereCondition = quickFilterConditions.length === 1 ? quickFilterConditions[0] : { and: quickFilterConditions };\n const query = {\n where: whereCondition,\n };\n const stringifiedQuery = stringify(query, { addQueryPrefix: true });\n return {\n ...entity,\n href: `${baseHref}${stringifiedQuery}`\n };\n }\n }\n }\n }\n return entity;\n });\n\n return {\n ...group,\n entities: processedEntities\n };\n });\n\n const LogoutComponent = RenderServerComponent({\n clientProps: {\n documentSubViewType,\n viewType,\n },\n Component: logout?.Button,\n Fallback: Logout,\n importMap: payload.importMap,\n serverProps: {\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n },\n })\n\n return (\n <NavWrapper baseClass={baseClass}>\n <nav className={`${baseClass}__wrap`}>\n {RenderServerComponent({\n clientProps: {\n documentSubViewType,\n viewType,\n },\n Component: beforeNavLinks,\n importMap: payload.importMap,\n serverProps: {\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n },\n })}\n <DefaultNavClient groups={processedGroups} navPreferences={navPreferences as NavPreferences} />\n {RenderServerComponent({\n clientProps: {\n documentSubViewType,\n viewType,\n },\n Component: afterNavLinks,\n importMap: payload.importMap,\n serverProps: {\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n },\n })}\n <div className={`${baseClass}__controls`}>{LogoutComponent}</div>\n </nav>\n <div className={`${baseClass}__header`}>\n <div className={`${baseClass}__header-content`}>\n <NavHamburger baseClass={baseClass} />\n </div>\n </div>\n </NavWrapper>\n )\n}\nexport default NavDefaultFilter;\n"],"names":["Logout","RenderServerComponent","EntityType","groupNavItems","React","formatAdminURL","parseWhereClauseToFilterValues","buildQuickFilterConditions","stringify","NavHamburger","NavWrapper","window","catch","err","console","warn","baseClass","getNavPrefs","DefaultNavClient","findFieldByName","fields","fieldName","directMatch","find","f","name","item","type","Array","isArray","nestedMatch","tabs","tab","tabMatch","blocks","block","blockMatch","NavDefaultFilter","props","documentSubViewType","i18n","locale","params","payload","permissions","req","searchParams","user","viewType","visibleEntities","config","admin","components","afterNavLinks","beforeNavLinks","logout","collections","globals","groups","filter","slug","includes","map","collection","entity","global","navPreferences","processedGroups","group","processedEntities","entities","c","custom","defaultFilter","baseHref","adminRoute","routes","path","filterList","flat","field","fieldConfig","options","label","row","width","undefined","Boolean","length","filterValues","language","Object","keys","quickFilterConditions","whereCondition","and","query","where","stringifiedQuery","addQueryPrefix","href","LogoutComponent","clientProps","Component","Button","Fallback","import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