@payloadcms/next 3.80.0-internal.cdd7ef7 → 3.80.0

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.
Files changed (105) hide show
  1. package/dist/elements/Nav/getNavPrefs.d.ts.map +1 -1
  2. package/dist/elements/Nav/getNavPrefs.js +2 -36
  3. package/dist/elements/Nav/getNavPrefs.js.map +1 -1
  4. package/dist/elements/Nav/index.client.d.ts.map +1 -1
  5. package/dist/elements/Nav/index.client.js +44 -27
  6. package/dist/elements/Nav/index.client.js.map +1 -1
  7. package/dist/elements/Nav/index.d.ts.map +1 -1
  8. package/dist/elements/Nav/index.js +7 -35
  9. package/dist/elements/Nav/index.js.map +1 -1
  10. package/dist/exports/client.d.ts +1 -2
  11. package/dist/exports/client.d.ts.map +1 -1
  12. package/dist/exports/client.js +1 -2
  13. package/dist/exports/client.js.map +1 -1
  14. package/dist/exports/rsc.d.ts +1 -2
  15. package/dist/exports/rsc.d.ts.map +1 -1
  16. package/dist/exports/rsc.js +1 -2
  17. package/dist/exports/rsc.js.map +1 -1
  18. package/dist/exports/utilities.d.ts +0 -2
  19. package/dist/exports/utilities.d.ts.map +1 -1
  20. package/dist/exports/utilities.js +0 -1
  21. package/dist/exports/utilities.js.map +1 -1
  22. package/dist/prod/styles.css +1 -1
  23. package/dist/utilities/handleServerFunctions.js +2 -2
  24. package/dist/utilities/handleServerFunctions.js.map +1 -1
  25. package/dist/views/BrowseByFolder/buildView.d.ts +13 -0
  26. package/dist/views/BrowseByFolder/buildView.d.ts.map +1 -0
  27. package/dist/views/BrowseByFolder/buildView.js +170 -0
  28. package/dist/views/BrowseByFolder/buildView.js.map +1 -0
  29. package/dist/views/BrowseByFolder/index.d.ts +4 -0
  30. package/dist/views/BrowseByFolder/index.d.ts.map +1 -0
  31. package/dist/views/BrowseByFolder/index.js +20 -0
  32. package/dist/views/BrowseByFolder/index.js.map +1 -0
  33. package/dist/views/BrowseByFolder/metadata.d.ts +4 -0
  34. package/dist/views/BrowseByFolder/metadata.d.ts.map +1 -0
  35. package/dist/views/BrowseByFolder/metadata.js +18 -0
  36. package/dist/views/BrowseByFolder/metadata.js.map +1 -0
  37. package/dist/views/CollectionFolders/buildView.d.ts +15 -0
  38. package/dist/views/CollectionFolders/buildView.d.ts.map +1 -0
  39. package/dist/views/CollectionFolders/buildView.js +156 -0
  40. package/dist/views/CollectionFolders/buildView.js.map +1 -0
  41. package/dist/views/CollectionFolders/index.d.ts +4 -0
  42. package/dist/views/CollectionFolders/index.d.ts.map +1 -0
  43. package/dist/views/CollectionFolders/index.js +20 -0
  44. package/dist/views/CollectionFolders/index.js.map +1 -0
  45. package/dist/views/CollectionFolders/metadata.d.ts +7 -0
  46. package/dist/views/CollectionFolders/metadata.d.ts.map +1 -0
  47. package/dist/views/CollectionFolders/metadata.js +25 -0
  48. package/dist/views/CollectionFolders/metadata.js.map +1 -0
  49. package/dist/views/CollectionFolders/renderFolderViewSlots.d.ts +11 -0
  50. package/dist/views/CollectionFolders/renderFolderViewSlots.d.ts.map +1 -0
  51. package/dist/views/CollectionFolders/renderFolderViewSlots.js +64 -0
  52. package/dist/views/CollectionFolders/renderFolderViewSlots.js.map +1 -0
  53. package/dist/views/Document/renderDocumentSlots.d.ts.map +1 -1
  54. package/dist/views/Document/renderDocumentSlots.js +0 -8
  55. package/dist/views/Document/renderDocumentSlots.js.map +1 -1
  56. package/dist/views/List/index.d.ts.map +1 -1
  57. package/dist/views/List/index.js +28 -84
  58. package/dist/views/List/index.js.map +1 -1
  59. package/dist/views/Root/getRouteData.d.ts +4 -1
  60. package/dist/views/Root/getRouteData.d.ts.map +1 -1
  61. package/dist/views/Root/getRouteData.js +91 -27
  62. package/dist/views/Root/getRouteData.js.map +1 -1
  63. package/dist/views/Root/index.d.ts.map +1 -1
  64. package/dist/views/Root/index.js +11 -5
  65. package/dist/views/Root/index.js.map +1 -1
  66. package/dist/views/Root/metadata.d.ts.map +1 -1
  67. package/dist/views/Root/metadata.js +37 -1
  68. package/dist/views/Root/metadata.js.map +1 -1
  69. package/package.json +7 -7
  70. package/dist/elements/HierarchyTypeField/index.d.ts +0 -9
  71. package/dist/elements/HierarchyTypeField/index.d.ts.map +0 -1
  72. package/dist/elements/HierarchyTypeField/index.js +0 -114
  73. package/dist/elements/HierarchyTypeField/index.js.map +0 -1
  74. package/dist/elements/HierarchyTypeField/index.server.d.ts +0 -9
  75. package/dist/elements/HierarchyTypeField/index.server.d.ts.map +0 -1
  76. package/dist/elements/HierarchyTypeField/index.server.js +0 -32
  77. package/dist/elements/HierarchyTypeField/index.server.js.map +0 -1
  78. package/dist/elements/Nav/SidebarTabs/TabError/index.d.ts +0 -8
  79. package/dist/elements/Nav/SidebarTabs/TabError/index.d.ts.map +0 -1
  80. package/dist/elements/Nav/SidebarTabs/TabError/index.js +0 -42
  81. package/dist/elements/Nav/SidebarTabs/TabError/index.js.map +0 -1
  82. package/dist/elements/Nav/SidebarTabs/constants.d.ts +0 -2
  83. package/dist/elements/Nav/SidebarTabs/constants.d.ts.map +0 -1
  84. package/dist/elements/Nav/SidebarTabs/constants.js +0 -2
  85. package/dist/elements/Nav/SidebarTabs/constants.js.map +0 -1
  86. package/dist/elements/Nav/SidebarTabs/index.client.d.ts +0 -22
  87. package/dist/elements/Nav/SidebarTabs/index.client.d.ts.map +0 -1
  88. package/dist/elements/Nav/SidebarTabs/index.client.js +0 -194
  89. package/dist/elements/Nav/SidebarTabs/index.client.js.map +0 -1
  90. package/dist/elements/Nav/SidebarTabs/index.d.ts +0 -17
  91. package/dist/elements/Nav/SidebarTabs/index.d.ts.map +0 -1
  92. package/dist/elements/Nav/SidebarTabs/index.js +0 -85
  93. package/dist/elements/Nav/SidebarTabs/index.js.map +0 -1
  94. package/dist/elements/Nav/SidebarTabs/renderTabServerFn.d.ts +0 -10
  95. package/dist/elements/Nav/SidebarTabs/renderTabServerFn.d.ts.map +0 -1
  96. package/dist/elements/Nav/SidebarTabs/renderTabServerFn.js +0 -54
  97. package/dist/elements/Nav/SidebarTabs/renderTabServerFn.js.map +0 -1
  98. package/dist/utilities/getHierarchyAncestry.d.ts +0 -24
  99. package/dist/utilities/getHierarchyAncestry.d.ts.map +0 -1
  100. package/dist/utilities/getHierarchyAncestry.js +0 -103
  101. package/dist/utilities/getHierarchyAncestry.js.map +0 -1
  102. package/dist/views/List/handleHierarchy.d.ts +0 -18
  103. package/dist/views/List/handleHierarchy.d.ts.map +0 -1
  104. package/dist/views/List/handleHierarchy.js +0 -258
  105. package/dist/views/List/handleHierarchy.js.map +0 -1
@@ -1,85 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { getTranslation } from '@payloadcms/translations';
3
- import { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent';
4
- import React from 'react';
5
- import { SidebarTabsClient } from './index.client.js';
6
- const baseClass = 'sidebar-tabs';
7
- export const SidebarTabs = props => {
8
- const {
9
- documentSubViewType,
10
- i18n,
11
- locale,
12
- navPreferences,
13
- params,
14
- payload,
15
- permissions,
16
- req,
17
- searchParams,
18
- tabs,
19
- user,
20
- viewType
21
- } = props;
22
- // Determine which tab should be active on initial load
23
- // First try saved preference, then default tab, then first tab
24
- const preferredTabSlug = navPreferences.activeTab || tabs.find(tab => tab.isDefaultActive)?.slug || tabs[0]?.slug;
25
- // Verify the preferred tab actually exists, otherwise fall back to default or first tab
26
- const activeTab = tabs.find(t => t.slug === preferredTabSlug) || tabs.find(tab => tab.isDefaultActive) || tabs[0];
27
- const initialActiveTabID = activeTab?.slug || tabs[0]?.slug;
28
- // Build initial tab contents
29
- // Strategy: Pre-render tabs that are already React elements (can't be lazy-loaded),
30
- // and only render the initially active tab if it's a CustomComponent (can be lazy-loaded)
31
- const initialTabContents = {};
32
- const renderComponent = component => {
33
- // Check if component is already a React node (payload provided React component)
34
- if (/*#__PURE__*/React.isValidElement(component)) {
35
- return component;
36
- } else {
37
- // Otherwise render it as a CustomComponent
38
- return RenderServerComponent({
39
- clientProps: {
40
- documentSubViewType,
41
- viewType
42
- },
43
- Component: component,
44
- importMap: payload.importMap,
45
- serverProps: {
46
- i18n,
47
- locale,
48
- params,
49
- payload,
50
- permissions,
51
- req,
52
- searchParams,
53
- user
54
- }
55
- });
56
- }
57
- };
58
- for (const tab of tabs) {
59
- if (/*#__PURE__*/React.isValidElement(tab.components.Content)) {
60
- initialTabContents[tab.slug] = tab.components.Content;
61
- }
62
- }
63
- // If the active tab is a CustomComponent (lazy-loadable), render it now
64
- if (activeTab && ! /*#__PURE__*/React.isValidElement(activeTab.components.Content)) {
65
- initialTabContents[activeTab.slug] = renderComponent(activeTab.components.Content);
66
- }
67
- return /*#__PURE__*/_jsx(SidebarTabsClient, {
68
- baseClass: baseClass,
69
- initialActiveTabID: initialActiveTabID,
70
- initialTabContents: initialTabContents,
71
- tabs: tabs.map(tab => {
72
- const labelText = tab.label ? getTranslation(tab.label, i18n) : tab.slug;
73
- // CustomComponents can be lazy-loaded/revalidated, React elements cannot
74
- const isLazyLoadable = ! /*#__PURE__*/React.isValidElement(tab.components.Content);
75
- return {
76
- slug: tab.slug,
77
- icon: renderComponent(tab.components.Icon),
78
- isDefaultActive: tab.isDefaultActive,
79
- label: labelText,
80
- lazyLoadable: isLazyLoadable
81
- };
82
- })
83
- });
84
- };
85
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["getTranslation","RenderServerComponent","React","SidebarTabsClient","baseClass","SidebarTabs","props","documentSubViewType","i18n","locale","navPreferences","params","payload","permissions","req","searchParams","tabs","user","viewType","preferredTabSlug","activeTab","find","tab","isDefaultActive","slug","t","initialActiveTabID","initialTabContents","renderComponent","component","isValidElement","clientProps","Component","importMap","serverProps","components","Content","_jsx","map","labelText","label","isLazyLoadable","icon","Icon","lazyLoadable"],"sources":["../../../../src/elements/Nav/SidebarTabs/index.tsx"],"sourcesContent":["import type { NavPreferences, PayloadComponent, SidebarTab } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport React from 'react'\n\nimport type { NavProps } from '../index.js'\n\nimport { SidebarTabsClient } from './index.client.js'\nimport './index.scss'\n\ntype SidebarTabWithReactNode = {\n components: {\n Content: PayloadComponent | React.ReactNode\n Icon: PayloadComponent | React.ReactNode\n }\n} & Omit<SidebarTab, 'components'>\n\nexport type SidebarTabsProps = {\n navPreferences: NavPreferences\n tabs: SidebarTabWithReactNode[]\n} & NavProps\n\nconst baseClass = 'sidebar-tabs'\n\nexport const SidebarTabs: React.FC<SidebarTabsProps> = (props) => {\n const {\n documentSubViewType,\n i18n,\n locale,\n navPreferences,\n params,\n payload,\n permissions,\n req,\n searchParams,\n tabs,\n user,\n viewType,\n } = props\n\n // Determine which tab should be active on initial load\n // First try saved preference, then default tab, then first tab\n const preferredTabSlug =\n navPreferences.activeTab || tabs.find((tab) => tab.isDefaultActive)?.slug || tabs[0]?.slug\n\n // Verify the preferred tab actually exists, otherwise fall back to default or first tab\n const activeTab =\n tabs.find((t) => t.slug === preferredTabSlug) ||\n tabs.find((tab) => tab.isDefaultActive) ||\n tabs[0]\n\n const initialActiveTabID = activeTab?.slug || tabs[0]?.slug\n\n // Build initial tab contents\n // Strategy: Pre-render tabs that are already React elements (can't be lazy-loaded),\n // and only render the initially active tab if it's a CustomComponent (can be lazy-loaded)\n const initialTabContents: Record<string, React.ReactNode> = {}\n\n const renderComponent = (component: PayloadComponent | React.ReactNode): React.ReactNode => {\n // Check if component is already a React node (payload provided React component)\n if (React.isValidElement(component)) {\n return component\n } else {\n // Otherwise render it as a CustomComponent\n return RenderServerComponent({\n clientProps: {\n documentSubViewType,\n viewType,\n },\n Component: component as PayloadComponent,\n importMap: payload.importMap,\n serverProps: {\n i18n,\n locale,\n params,\n payload,\n permissions,\n req,\n searchParams,\n user,\n },\n })\n }\n }\n\n for (const tab of tabs) {\n if (React.isValidElement(tab.components.Content)) {\n initialTabContents[tab.slug] = tab.components.Content\n }\n }\n\n // If the active tab is a CustomComponent (lazy-loadable), render it now\n if (activeTab && !React.isValidElement(activeTab.components.Content)) {\n initialTabContents[activeTab.slug] = renderComponent(activeTab.components.Content)\n }\n\n return (\n <SidebarTabsClient\n baseClass={baseClass}\n initialActiveTabID={initialActiveTabID}\n initialTabContents={initialTabContents}\n tabs={tabs.map((tab) => {\n const labelText = tab.label ? getTranslation(tab.label, i18n) : tab.slug\n // CustomComponents can be lazy-loaded/revalidated, React elements cannot\n const isLazyLoadable = !React.isValidElement(tab.components.Content)\n\n return {\n slug: tab.slug,\n icon: renderComponent(tab.components.Icon),\n isDefaultActive: tab.isDefaultActive,\n label: labelText,\n lazyLoadable: isLazyLoadable,\n }\n })}\n />\n )\n}\n"],"mappings":";AAEA,SAASA,cAAc,QAAQ;AAC/B,SAASC,qBAAqB,QAAQ;AACtC,OAAOC,KAAA,MAAW;AAIlB,SAASC,iBAAiB,QAAQ;AAelC,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,WAAA,GAA2CC,KAAA;EACtD,MAAM;IACJC,mBAAmB;IACnBC,IAAI;IACJC,MAAM;IACNC,cAAc;IACdC,MAAM;IACNC,OAAO;IACPC,WAAW;IACXC,GAAG;IACHC,YAAY;IACZC,IAAI;IACJC,IAAI;IACJC;EAAQ,CACT,GAAGZ,KAAA;EAEJ;EACA;EACA,MAAMa,gBAAA,GACJT,cAAA,CAAeU,SAAS,IAAIJ,IAAA,CAAKK,IAAI,CAAEC,GAAA,IAAQA,GAAA,CAAIC,eAAe,GAAGC,IAAA,IAAQR,IAAI,CAAC,EAAE,EAAEQ,IAAA;EAExF;EACA,MAAMJ,SAAA,GACJJ,IAAA,CAAKK,IAAI,CAAEI,CAAA,IAAMA,CAAA,CAAED,IAAI,KAAKL,gBAAA,KAC5BH,IAAA,CAAKK,IAAI,CAAEC,GAAA,IAAQA,GAAA,CAAIC,eAAe,KACtCP,IAAI,CAAC,EAAE;EAET,MAAMU,kBAAA,GAAqBN,SAAA,EAAWI,IAAA,IAAQR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cAAA,GAAiB,eAACvC,KAAA,CAAM4B,cAAc,CAACR,GAAA,CAAIa,UAAU,CAACC,OAAO;MAEnE,OAAO;QACLZ,IAAA,EAAMF,GAAA,CAAIE,IAAI;QACdkB,IAAA,EAAMd,eAAA,CAAgBN,GAAA,CAAIa,UAAU,CAACQ,IAAI;QACzCpB,eAAA,EAAiBD,GAAA,CAAIC,eAAe;QACpCiB,KAAA,EAAOD,SAAA;QACPK,YAAA,EAAcH;MAChB;IACF;;AAGN","ignoreList":[]}
@@ -1,10 +0,0 @@
1
- import type { ServerFunction } from 'payload';
2
- import type React from 'react';
3
- export type RenderTabServerFnArgs = {
4
- tabSlug: string;
5
- };
6
- export type RenderTabServerFnReturnType = {
7
- component: React.ReactNode;
8
- };
9
- export declare const renderTabHandler: ServerFunction<RenderTabServerFnArgs, RenderTabServerFnReturnType>;
10
- //# sourceMappingURL=renderTabServerFn.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderTabServerFn.d.ts","sourceRoot":"","sources":["../../../../src/elements/Nav/SidebarTabs/renderTabServerFn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG;IACxC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,cAAc,CAC3C,qBAAqB,EACrB,2BAA2B,CA6C5B,CAAA"}
@@ -1,54 +0,0 @@
1
- import { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent';
2
- export const renderTabHandler = ({
3
- req,
4
- tabSlug
5
- }) => {
6
- if (!req.user) {
7
- throw new Error('Unauthorized');
8
- }
9
- const {
10
- importMap
11
- } = req.payload;
12
- const {
13
- tabs
14
- } = req.payload.config.admin.components?.sidebar || {};
15
- if (!tabs) {
16
- return {
17
- component: null
18
- };
19
- }
20
- const tabConfig = tabs.find(tab => tab.slug === tabSlug);
21
- if (!tabConfig) {
22
- return {
23
- component: null
24
- };
25
- }
26
- try {
27
- const component = RenderServerComponent({
28
- Component: tabConfig.components.Content,
29
- importMap,
30
- serverProps: {
31
- i18n: req.i18n,
32
- locale: req.locale,
33
- params: req.routeParams,
34
- payload: req.payload,
35
- req,
36
- searchParams: req.query,
37
- user: req.user
38
- }
39
- });
40
- return {
41
- component
42
- };
43
- } catch (error) {
44
- const errorMessage = error instanceof Error ? error.message : String(error);
45
- req.payload.logger.error({
46
- err: error,
47
- msg: `Error rendering tab "${tabSlug}": ${errorMessage}`
48
- });
49
- return {
50
- component: null
51
- };
52
- }
53
- };
54
- //# sourceMappingURL=renderTabServerFn.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderTabServerFn.js","names":["RenderServerComponent","renderTabHandler","req","tabSlug","user","Error","importMap","payload","tabs","config","admin","components","sidebar","component","tabConfig","find","tab","slug","Component","Content","serverProps","i18n","locale","params","routeParams","searchParams","query","error","errorMessage","message","String","logger","err","msg"],"sources":["../../../../src/elements/Nav/SidebarTabs/renderTabServerFn.ts"],"sourcesContent":["import type { ServerFunction } from 'payload'\nimport type React from 'react'\n\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\n\nexport type RenderTabServerFnArgs = {\n tabSlug: string\n}\n\nexport type RenderTabServerFnReturnType = {\n component: React.ReactNode\n}\n\nexport const renderTabHandler: ServerFunction<\n RenderTabServerFnArgs,\n RenderTabServerFnReturnType\n> = ({ req, tabSlug }) => {\n if (!req.user) {\n throw new Error('Unauthorized')\n }\n\n const { importMap } = req.payload\n const { tabs } = req.payload.config.admin.components?.sidebar || {}\n\n if (!tabs) {\n return { component: null }\n }\n\n const tabConfig = tabs.find((tab) => tab.slug === tabSlug)\n\n if (!tabConfig) {\n return { component: null }\n }\n\n try {\n const component = RenderServerComponent({\n Component: tabConfig.components.Content,\n importMap,\n serverProps: {\n i18n: req.i18n,\n locale: req.locale,\n params: req.routeParams,\n payload: req.payload,\n req,\n searchParams: req.query,\n user: req.user,\n },\n })\n\n return { component }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error)\n\n req.payload.logger.error({\n err: error,\n msg: `Error rendering tab \"${tabSlug}\": ${errorMessage}`,\n })\n\n return { component: null }\n }\n}\n"],"mappings":"AAGA,SAASA,qBAAqB,QAAQ;AAUtC,OAAO,MAAMC,gBAAA,GAGTA,CAAC;EAAEC,GAAG;EAAEC;AAAO,CAAE;EACnB,IAAI,CAACD,GAAA,CAAIE,IAAI,EAAE;IACb,MAAM,IAAIC,KAAA,CAAM;EAClB;EAEA,MAAM;IAAEC;EAAS,CAAE,GAAGJ,GAAA,CAAIK,OAAO;EACjC,MAAM;IAAEC;EAAI,CAAE,GAAGN,GAAA,CAAIK,OAAO,CAACE,MAAM,CAACC,KAAK,CAACC,UAAU,EAAEC,OAAA,IAAW,CAAC;EAElE,IAAI,CAACJ,IAAA,EAAM;IACT,OAAO;MAAEK,SAAA,EAAW;IAAK;EAC3B;EAEA,MAAMC,SAAA,GAAYN,IAAA,CAAKO,IAAI,CAAEC,GAAA,IAAQA,GAAA,CAAIC,IAAI,KAAKd,OAAA;EAElD,IAAI,CAACW,SAAA,EAAW;IACd,OAAO;MAAED,SAAA,EAAW;IAAK;EAC3B;EAEA,IAAI;IACF,MAAMA,SAAA,GAAYb,qBAAA,CAAsB;MACtCkB,SAAA,EAAWJ,SAAA,CAAUH,UAAU,CAACQ,OAAO;MACvCb,SAAA;MACAc,WAAA,EAAa;QACXC,IAAA,EAAMnB,GAAA,CAAImB,IAAI;QACdC,MAAA,EAAQpB,GAAA,CAAIoB,MAAM;QAClBC,MAAA,EAAQrB,GAAA,CAAIsB,WAAW;QACvBjB,OAAA,EAASL,GAAA,CAAIK,OAAO;QACpBL,GAAA;QACAuB,YAAA,EAAcvB,GAAA,CAAIwB,KAAK;QACvBtB,IAAA,EAAMF,GAAA,CAAIE;MACZ;IACF;IAEA,OAAO;MAAES;IAAU;EACrB,EAAE,OAAOc,KAAA,EAAO;IACd,MAAMC,YAAA,GAAeD,KAAA,YAAiBtB,KAAA,GAAQsB,KAAA,CAAME,OAAO,GAAGC,MAAA,CAAOH,KAAA;IAErEzB,GAAA,CAAIK,OAAO,CAACwB,MAAM,CAACJ,KAAK,CAAC;MACvBK,GAAA,EAAKL,KAAA;MACLM,GAAA,EAAK,wBAAwB9B,OAAA,MAAayB,YAAA;IAC5C;IAEA,OAAO;MAAEf,SAAA,EAAW;IAAK;EAC3B;AACF","ignoreList":[]}
@@ -1,24 +0,0 @@
1
- import type { Payload, PayloadRequest } from 'payload';
2
- export type HierarchyAncestryItem = {
3
- id: number | string;
4
- path: Array<{
5
- id: number | string;
6
- title: string;
7
- }>;
8
- title: string;
9
- };
10
- export type HierarchyAncestryResult = {
11
- items: HierarchyAncestryItem[];
12
- };
13
- export type GetHierarchyAncestryArgs = {
14
- hierarchySlug: string;
15
- ids: (number | string)[];
16
- payload: Payload;
17
- user?: PayloadRequest['user'];
18
- };
19
- /**
20
- * Returns full ancestry paths for hierarchy items.
21
- * Each item includes its own title and the path from root to self.
22
- */
23
- export declare function getHierarchyAncestry({ hierarchySlug, ids, payload, user, }: GetHierarchyAncestryArgs): Promise<HierarchyAncestryResult>;
24
- //# sourceMappingURL=getHierarchyAncestry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getHierarchyAncestry.d.ts","sourceRoot":"","sources":["../../src/utilities/getHierarchyAncestry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAEtD,MAAM,MAAM,qBAAqB,GAAG;IAClC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,IAAI,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACnD,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,qBAAqB,EAAE,CAAA;CAC/B,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,aAAa,EAAE,MAAM,CAAA;IACrB,GAAG,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IACxB,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;CAC9B,CAAA;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CAAC,EACzC,aAAa,EACb,GAAG,EACH,OAAO,EACP,IAAI,GACL,EAAE,wBAAwB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAyH7D"}
@@ -1,103 +0,0 @@
1
- /**
2
- * Returns full ancestry paths for hierarchy items.
3
- * Each item includes its own title and the path from root to self.
4
- */export async function getHierarchyAncestry({
5
- hierarchySlug,
6
- ids,
7
- payload,
8
- user
9
- }) {
10
- if (ids.length === 0) {
11
- return {
12
- items: []
13
- };
14
- }
15
- const collectionConfig = payload.collections[hierarchySlug]?.config;
16
- const hierarchyConfig = collectionConfig?.hierarchy && typeof collectionConfig.hierarchy === 'object' ? collectionConfig.hierarchy : undefined;
17
- if (!hierarchyConfig) {
18
- throw new Error(`Collection "${hierarchySlug}" is not a hierarchy`);
19
- }
20
- const parentFieldName = hierarchyConfig.parentFieldName;
21
- const useAsTitle = collectionConfig.admin?.useAsTitle || 'id';
22
- // Cache for already-fetched items to avoid redundant queries
23
- const itemCache = new Map();
24
- const fetchItem = async id => {
25
- const cached = itemCache.get(id);
26
- if (cached) {
27
- return cached;
28
- }
29
- try {
30
- const item = await payload.findByID({
31
- id,
32
- collection: hierarchySlug,
33
- depth: 0,
34
- overrideAccess: false,
35
- user
36
- });
37
- if (item) {
38
- itemCache.set(id, item);
39
- }
40
- return item;
41
- } catch {
42
- return null;
43
- }
44
- };
45
- const getTitle = (item, id) => {
46
- const rawTitle = item[useAsTitle] || item.id || id;
47
- if (rawTitle && typeof rawTitle === 'object') {
48
- return JSON.stringify(rawTitle);
49
- }
50
- if (typeof rawTitle === 'string') {
51
- return rawTitle;
52
- }
53
- if (typeof rawTitle === 'number') {
54
- return String(rawTitle);
55
- }
56
- return String(id);
57
- };
58
- const getParentId = item => {
59
- const parentValue = item[parentFieldName];
60
- if (!parentValue) {
61
- return null;
62
- }
63
- if (typeof parentValue === 'object' && parentValue !== null && 'id' in parentValue) {
64
- return parentValue.id;
65
- }
66
- return parentValue;
67
- };
68
- const buildPath = async (startItem, startId) => {
69
- const path = [];
70
- let currentItem = startItem;
71
- let currentId = startId;
72
- while (currentItem && currentId !== null) {
73
- path.unshift({
74
- id: currentId,
75
- title: getTitle(currentItem, currentId)
76
- });
77
- const nextParentId = getParentId(currentItem);
78
- if (!nextParentId) {
79
- break;
80
- }
81
- currentItem = await fetchItem(nextParentId);
82
- currentId = nextParentId;
83
- }
84
- return path;
85
- };
86
- const items = [];
87
- for (const id of ids) {
88
- const item = await fetchItem(id);
89
- if (!item) {
90
- continue;
91
- }
92
- const path = await buildPath(item, id);
93
- items.push({
94
- id,
95
- path,
96
- title: getTitle(item, id)
97
- });
98
- }
99
- return {
100
- items
101
- };
102
- }
103
- //# sourceMappingURL=getHierarchyAncestry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getHierarchyAncestry.js","names":["getHierarchyAncestry","hierarchySlug","ids","payload","user","length","items","collectionConfig","collections","config","hierarchyConfig","hierarchy","undefined","Error","parentFieldName","useAsTitle","admin","itemCache","Map","fetchItem","id","cached","get","item","findByID","collection","depth","overrideAccess","set","getTitle","rawTitle","JSON","stringify","String","getParentId","parentValue","buildPath","startItem","startId","path","currentItem","currentId","unshift","title","nextParentId","push"],"sources":["../../src/utilities/getHierarchyAncestry.ts"],"sourcesContent":["import type { Payload, PayloadRequest } from 'payload'\n\nexport type HierarchyAncestryItem = {\n id: number | string\n path: Array<{ id: number | string; title: string }>\n title: string\n}\n\nexport type HierarchyAncestryResult = {\n items: HierarchyAncestryItem[]\n}\n\nexport type GetHierarchyAncestryArgs = {\n hierarchySlug: string\n ids: (number | string)[]\n payload: Payload\n user?: PayloadRequest['user']\n}\n\n/**\n * Returns full ancestry paths for hierarchy items.\n * Each item includes its own title and the path from root to self.\n */\nexport async function getHierarchyAncestry({\n hierarchySlug,\n ids,\n payload,\n user,\n}: GetHierarchyAncestryArgs): Promise<HierarchyAncestryResult> {\n if (ids.length === 0) {\n return { items: [] }\n }\n\n const collectionConfig = payload.collections[hierarchySlug]?.config\n const hierarchyConfig =\n collectionConfig?.hierarchy && typeof collectionConfig.hierarchy === 'object'\n ? collectionConfig.hierarchy\n : undefined\n\n if (!hierarchyConfig) {\n throw new Error(`Collection \"${hierarchySlug}\" is not a hierarchy`)\n }\n\n const parentFieldName = hierarchyConfig.parentFieldName\n const useAsTitle = collectionConfig.admin?.useAsTitle || 'id'\n\n // Cache for already-fetched items to avoid redundant queries\n const itemCache = new Map<number | string, Record<string, unknown>>()\n\n const fetchItem = async (id: number | string): Promise<null | Record<string, unknown>> => {\n const cached = itemCache.get(id)\n if (cached) {\n return cached\n }\n\n try {\n const item = await payload.findByID({\n id,\n collection: hierarchySlug,\n depth: 0,\n overrideAccess: false,\n user,\n })\n\n if (item) {\n itemCache.set(id, item)\n }\n\n return item\n } catch {\n return null\n }\n }\n\n const getTitle = (item: Record<string, unknown>, id: number | string): string => {\n const rawTitle = item[useAsTitle] || item.id || id\n\n if (rawTitle && typeof rawTitle === 'object') {\n return JSON.stringify(rawTitle)\n }\n\n if (typeof rawTitle === 'string') {\n return rawTitle\n }\n\n if (typeof rawTitle === 'number') {\n return String(rawTitle)\n }\n\n return String(id)\n }\n\n const getParentId = (item: Record<string, unknown>): null | number | string => {\n const parentValue = item[parentFieldName]\n\n if (!parentValue) {\n return null\n }\n\n if (typeof parentValue === 'object' && parentValue !== null && 'id' in parentValue) {\n return (parentValue as { id: number | string }).id\n }\n\n return parentValue as number | string\n }\n\n const buildPath = async (\n startItem: Record<string, unknown>,\n startId: number | string,\n ): Promise<Array<{ id: number | string; title: string }>> => {\n const path: Array<{ id: number | string; title: string }> = []\n let currentItem: null | Record<string, unknown> = startItem\n let currentId: null | number | string = startId\n\n while (currentItem && currentId !== null) {\n path.unshift({\n id: currentId,\n title: getTitle(currentItem, currentId),\n })\n\n const nextParentId = getParentId(currentItem)\n if (!nextParentId) {\n break\n }\n\n currentItem = await fetchItem(nextParentId)\n currentId = nextParentId\n }\n\n return path\n }\n\n const items: HierarchyAncestryItem[] = []\n\n for (const id of ids) {\n const item = await fetchItem(id)\n if (!item) {\n continue\n }\n\n const path = await buildPath(item, id)\n items.push({\n id,\n path,\n title: getTitle(item, id),\n })\n }\n\n return { items }\n}\n"],"mappings":"AAmBA;;;GAIA,OAAO,eAAeA,qBAAqB;EACzCC,aAAa;EACbC,GAAG;EACHC,OAAO;EACPC;AAAI,CACqB;EACzB,IAAIF,GAAA,CAAIG,MAAM,KAAK,GAAG;IACpB,OAAO;MAAEC,KAAA,EAAO;IAAG;EACrB;EAEA,MAAMC,gBAAA,GAAmBJ,OAAA,CAAQK,WAAW,CAACP,aAAA,CAAc,EAAEQ,MAAA;EAC7D,MAAMC,eAAA,GACJH,gBAAA,EAAkBI,SAAA,IAAa,OAAOJ,gBAAA,CAAiBI,SAAS,KAAK,WACjEJ,gBAAA,CAAiBI,SAAS,GAC1BC,SAAA;EAEN,IAAI,CAACF,eAAA,EAAiB;IACpB,MAAM,IAAIG,KAAA,CAAM,eAAeZ,aAAA,sBAAmC;EACpE;EAEA,MAAMa,eAAA,GAAkBJ,eAAA,CAAgBI,eAAe;EACvD,MAAMC,UAAA,GAAaR,gBAAA,CAAiBS,KAAK,EAAED,UAAA,IAAc;EAEzD;EACA,MAAME,SAAA,GAAY,IAAIC,GAAA;EAEtB,MAAMC,SAAA,GAAY,MAAOC,EAAA;IACvB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;IAClD,IAAII,SAAA,GAAoCH,OAAA;IAExC,OAAOE,WAAA,IAAeC,SAAA,KAAc,MAAM;MACxCF,IAAA,CAAKG,OAAO,CAAC;QACXtB,EAAA,EAAIqB,SAAA;QACJE,KAAA,EAAOd,QAAA,CAASW,WAAA,EAAaC,SAAA;MAC/B;MAEA,MAAMG,YAAA,GAAeV,WAAA,CAAYM,WAAA;MACjC,IAAI,CAACI,YAAA,EAAc;QACjB;MACF;MAEAJ,WAAA,GAAc,MAAMrB,SAAA,CAAUyB,YAAA;MAC9BH,SAAA,GAAYG,YAAA;IACd;IAEA,OAAOL,IAAA;EACT;EAEA,MAAMjC,KAAA,GAAiC,EAAE;EAEzC,KAAK,MAAMc,EAAA,IAAMlB,GAAA,EAAK;IACpB,MAAMqB,IAAA,GAAO,MAAMJ,SAAA,CAAUC,EAAA;IAC7B,IAAI,CAACG,IAAA,EAAM;MACT;IACF;IAEA,MAAMgB,IAAA,GAAO,MAAMH,SAAA,CAAUb,IAAA,EAAMH,EAAA;IACnCd,KAAA,CAAMuC,IAAI,CAAC;MACTzB,EAAA;MACAmB,IAAA;MACAI,KAAA,EAAOd,QAAA,CAASN,IAAA,EAAMH,EAAA;IACxB;EACF;EAEA,OAAO;IAAEd;EAAM;AACjB","ignoreList":[]}
@@ -1,18 +0,0 @@
1
- import type { HierarchyViewData, PayloadRequest, SanitizedCollectionConfig, SanitizedPermissions, Where } from 'payload';
2
- /**
3
- * Fetches hierarchy data for a collection with a selected parent.
4
- * Returns data that can be rendered client-side by HierarchyTable.
5
- */
6
- export declare const handleHierarchy: ({ baseFilter, collectionConfig, collectionSlug, parentId, permissions, req, search, typeFilter, user, }: {
7
- baseFilter?: null | Where;
8
- collectionConfig: SanitizedCollectionConfig;
9
- collectionSlug: string;
10
- parentId: null | number | string;
11
- permissions?: SanitizedPermissions;
12
- req: PayloadRequest;
13
- search?: string;
14
- /** Filter hierarchy items by their collectionSpecific type field */
15
- typeFilter?: string[];
16
- user: PayloadRequest["user"];
17
- }) => Promise<HierarchyViewData>;
18
- //# sourceMappingURL=handleHierarchy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handleHierarchy.d.ts","sourceRoot":"","sources":["../../../src/views/List/handleHierarchy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EAEd,yBAAyB,EACzB,oBAAoB,EAEpB,KAAK,EACN,MAAM,SAAS,CAAA;AAMhB;;;GAGG;AACH,eAAO,MAAM,eAAe,4GAUzB;IACD,UAAU,CAAC,EAAE,IAAI,GAAG,KAAK,CAAA;IACzB,gBAAgB,EAAE,yBAAyB,CAAA;IAC3C,cAAc,EAAE,MAAM,CAAA;IACtB,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAA;IAChC,WAAW,CAAC,EAAE,oBAAoB,CAAA;IAClC,GAAG,EAAE,cAAc,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;CAC7B,KAAG,OAAO,CAAC,iBAAiB,CAkP5B,CAAA"}
@@ -1,258 +0,0 @@
1
- import { getTranslation } from '@payloadcms/translations';
2
- import { getAncestors } from 'payload';
3
- import { combineWhereConstraints, DEFAULT_HIERARCHY_LIST_LIMIT } from 'payload/shared';
4
- /**
5
- * Fetches hierarchy data for a collection with a selected parent.
6
- * Returns data that can be rendered client-side by HierarchyTable.
7
- */
8
- export const handleHierarchy = async ({
9
- baseFilter,
10
- collectionConfig,
11
- collectionSlug,
12
- parentId,
13
- permissions,
14
- req,
15
- search,
16
- typeFilter,
17
- user
18
- }) => {
19
- const hierarchyConfig = collectionConfig.hierarchy && typeof collectionConfig.hierarchy === 'object' ? collectionConfig.hierarchy : undefined;
20
- if (!hierarchyConfig) {
21
- throw new Error('Collection is not a hierarchy');
22
- }
23
- const parentFieldName = hierarchyConfig.parentFieldName;
24
- const useAsTitle = collectionConfig.admin?.useAsTitle || 'id';
25
- // Fetch the parent item and breadcrumbs (skip for root level)
26
- let parent = null;
27
- let breadcrumbs = [];
28
- if (parentId !== null) {
29
- try {
30
- const [item, ancestors] = await Promise.all([req.payload.findByID({
31
- id: parentId,
32
- collection: collectionSlug,
33
- depth: 0,
34
- overrideAccess: false,
35
- req,
36
- user
37
- }), getAncestors({
38
- id: parentId,
39
- collectionSlug,
40
- req
41
- })]);
42
- parent = item;
43
- breadcrumbs = ancestors;
44
- } catch (_error) {
45
- req.payload.logger.warn({
46
- msg: `Hierarchy item not found: ${parentId}`
47
- });
48
- }
49
- }
50
- // Build children where clause
51
- // For root level (parentId is null), find items without a parent
52
- // For nested level, find items with this specific parent
53
- const parentCondition = parentId === null ? {
54
- or: [{
55
- [parentFieldName]: {
56
- exists: false
57
- }
58
- }, {
59
- [parentFieldName]: {
60
- equals: null
61
- }
62
- }]
63
- } : {
64
- [parentFieldName]: {
65
- equals: parentId
66
- }
67
- };
68
- // Build type filter condition if typeFilter is provided and collectionSpecific is configured
69
- // Filter to folders that allow ANY of the selected types OR are unrestricted
70
- let typeCondition;
71
- if (typeFilter && typeFilter.length > 0 && hierarchyConfig.collectionSpecific && typeof hierarchyConfig.collectionSpecific === 'object') {
72
- const typeFieldName = hierarchyConfig.collectionSpecific.fieldName;
73
- // Exclude the hierarchy collection itself from the filter (folders always show folders)
74
- const filteredTypes = typeFilter.filter(t => t !== collectionSlug);
75
- if (filteredTypes.length > 0) {
76
- typeCondition = {
77
- or: [{
78
- [typeFieldName]: {
79
- in: filteredTypes
80
- }
81
- }, {
82
- [typeFieldName]: {
83
- exists: false
84
- }
85
- }]
86
- };
87
- }
88
- }
89
- // Combine conditions: parent + search + typeFilter
90
- const conditions = [parentCondition];
91
- if (search) {
92
- conditions.push({
93
- [useAsTitle]: {
94
- like: search
95
- }
96
- });
97
- }
98
- if (typeCondition) {
99
- conditions.push(typeCondition);
100
- }
101
- const childrenWhere = conditions.length > 1 ? {
102
- and: conditions
103
- } : parentCondition;
104
- // Fetch children (hierarchy items with this parent, or root items if parentId is null)
105
- const childrenData = await req.payload.find({
106
- collection: collectionSlug,
107
- depth: 0,
108
- draft: true,
109
- fallbackLocale: false,
110
- includeLockStatus: true,
111
- limit: DEFAULT_HIERARCHY_LIST_LIMIT,
112
- locale: req.locale,
113
- overrideAccess: false,
114
- page: 1,
115
- req,
116
- user,
117
- where: combineWhereConstraints([childrenWhere, baseFilter])
118
- });
119
- // Fetch related documents from other collections
120
- // At root level: show unassigned documents (where hierarchy field doesn't exist)
121
- // At nested level: show documents assigned to the selected hierarchy item
122
- const relatedDocumentsByCollection = {};
123
- const relatedBaseFilters = {};
124
- // Use pre-computed relatedCollections from sanitized hierarchy config
125
- const relatedCollectionsConfig = hierarchyConfig.relatedCollections || {};
126
- for (const [relatedSlug, fieldInfo] of Object.entries(relatedCollectionsConfig)) {
127
- if (relatedSlug === collectionSlug) {
128
- continue;
129
- }
130
- const relatedCollectionConfig = req.payload.collections[relatedSlug]?.config;
131
- if (!relatedCollectionConfig) {
132
- continue;
133
- }
134
- // Check if user has read permission for this collection
135
- if (!permissions?.collections?.[relatedSlug]?.read) {
136
- continue;
137
- }
138
- const {
139
- fieldName,
140
- hasMany
141
- } = fieldInfo;
142
- // Get baseFilter for this related collection
143
- const relatedBaseFilter = await (relatedCollectionConfig.admin?.baseFilter ?? relatedCollectionConfig.admin?.baseListFilter)?.({
144
- limit: DEFAULT_HIERARCHY_LIST_LIMIT,
145
- page: 1,
146
- req,
147
- sort: undefined
148
- });
149
- if (relatedBaseFilter) {
150
- relatedBaseFilters[relatedSlug] = relatedBaseFilter;
151
- }
152
- // Build where clause based on whether we're at root or nested level
153
- let relationshipWhere;
154
- if (parentId === null) {
155
- // Root level: find documents where hierarchy field doesn't exist, is null, or is empty array
156
- const conditions = [{
157
- [fieldName]: {
158
- exists: false
159
- }
160
- }, {
161
- [fieldName]: {
162
- equals: null
163
- }
164
- }];
165
- if (hasMany) {
166
- // hasMany fields store cleared values as empty arrays
167
- conditions.push({
168
- [fieldName]: {
169
- equals: []
170
- }
171
- });
172
- }
173
- relationshipWhere = {
174
- or: conditions
175
- };
176
- } else {
177
- // Nested level: find documents assigned to this hierarchy item
178
- // "in" operator works for both hasMany and single relationship fields
179
- relationshipWhere = {
180
- [fieldName]: {
181
- in: [parentId]
182
- }
183
- };
184
- }
185
- // Add search filter if provided
186
- const relatedUseAsTitle = relatedCollectionConfig.admin?.useAsTitle || 'id';
187
- const whereWithSearch = search ? {
188
- and: [relationshipWhere, {
189
- [relatedUseAsTitle]: {
190
- like: search
191
- }
192
- }]
193
- } : relationshipWhere;
194
- // Combine relationship where with related collection's baseFilter
195
- const where = combineWhereConstraints([whereWithSearch, relatedBaseFilter]);
196
- try {
197
- const data = await req.payload.find({
198
- collection: relatedSlug,
199
- depth: 0,
200
- draft: true,
201
- fallbackLocale: false,
202
- includeLockStatus: true,
203
- limit: DEFAULT_HIERARCHY_LIST_LIMIT,
204
- locale: req.locale,
205
- overrideAccess: false,
206
- page: 1,
207
- req,
208
- user,
209
- where
210
- });
211
- if (data.totalDocs > 0) {
212
- relatedDocumentsByCollection[relatedSlug] = {
213
- hasMany,
214
- label: getTranslation(relatedCollectionConfig.labels?.plural, req.i18n),
215
- result: data
216
- };
217
- }
218
- } catch (error) {
219
- req.payload.logger.warn({
220
- err: error,
221
- msg: `Failed to query related collection ${relatedSlug}`
222
- });
223
- }
224
- }
225
- // Extract allowed collections from parent's collectionSpecific field
226
- // - undefined: collectionSpecific not configured, no filtering needed
227
- // - []: parent folder accepts everything, can only move to unrestricted destinations
228
- // - [{ slug, label }, ...]: parent folder has restrictions
229
- let allowedCollections;
230
- if (hierarchyConfig.collectionSpecific && parent) {
231
- const typeFieldName = hierarchyConfig.collectionSpecific.fieldName;
232
- const typeValues = parent[typeFieldName];
233
- if (typeValues && typeValues.length > 0) {
234
- allowedCollections = typeValues.map(slug => {
235
- const config = req.payload.collections[slug]?.config;
236
- const label = config ? getTranslation(config.labels?.plural, req.i18n) : slug;
237
- return {
238
- slug,
239
- label
240
- };
241
- });
242
- } else {
243
- // Parent folder accepts everything (type is null or empty)
244
- allowedCollections = [];
245
- }
246
- }
247
- return {
248
- allowedCollections,
249
- breadcrumbs,
250
- childrenData,
251
- parent,
252
- parentFieldName,
253
- parentId,
254
- relatedBaseFilters: Object.keys(relatedBaseFilters).length > 0 ? relatedBaseFilters : undefined,
255
- relatedDocumentsByCollection
256
- };
257
- };
258
- //# sourceMappingURL=handleHierarchy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handleHierarchy.js","names":["getTranslation","getAncestors","combineWhereConstraints","DEFAULT_HIERARCHY_LIST_LIMIT","handleHierarchy","baseFilter","collectionConfig","collectionSlug","parentId","permissions","req","search","typeFilter","user","hierarchyConfig","hierarchy","undefined","Error","parentFieldName","useAsTitle","admin","parent","breadcrumbs","item","ancestors","Promise","all","payload","findByID","id","collection","depth","overrideAccess","_error","logger","warn","msg","parentCondition","or","exists","equals","typeCondition","length","collectionSpecific","typeFieldName","fieldName","filteredTypes","filter","t","in","conditions","push","like","childrenWhere","and","childrenData","find","draft","fallbackLocale","includeLockStatus","limit","locale","page","where","relatedDocumentsByCollection","relatedBaseFilters","relatedCollectionsConfig","relatedCollections","relatedSlug","fieldInfo","Object","entries","relatedCollectionConfig","collections","config","read","hasMany","relatedBaseFilter","baseListFilter","sort","relationshipWhere","relatedUseAsTitle","whereWithSearch","data","totalDocs","label","labels","plural","i18n","result","error","err","allowedCollections","typeValues","map","slug","keys"],"sources":["../../../src/views/List/handleHierarchy.ts"],"sourcesContent":["import type {\n HierarchyViewData,\n PayloadRequest,\n RelatedDocumentsGrouped,\n SanitizedCollectionConfig,\n SanitizedPermissions,\n TypeWithID,\n Where,\n} from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { getAncestors } from 'payload'\nimport { combineWhereConstraints, DEFAULT_HIERARCHY_LIST_LIMIT } from 'payload/shared'\n\n/**\n * Fetches hierarchy data for a collection with a selected parent.\n * Returns data that can be rendered client-side by HierarchyTable.\n */\nexport const handleHierarchy = async ({\n baseFilter,\n collectionConfig,\n collectionSlug,\n parentId,\n permissions,\n req,\n search,\n typeFilter,\n user,\n}: {\n baseFilter?: null | Where\n collectionConfig: SanitizedCollectionConfig\n collectionSlug: string\n parentId: null | number | string\n permissions?: SanitizedPermissions\n req: PayloadRequest\n search?: string\n /** Filter hierarchy items by their collectionSpecific type field */\n typeFilter?: string[]\n user: PayloadRequest['user']\n}): Promise<HierarchyViewData> => {\n const hierarchyConfig =\n collectionConfig.hierarchy && typeof collectionConfig.hierarchy === 'object'\n ? collectionConfig.hierarchy\n : undefined\n\n if (!hierarchyConfig) {\n throw new Error('Collection is not a hierarchy')\n }\n\n const parentFieldName = hierarchyConfig.parentFieldName\n\n const useAsTitle = collectionConfig.admin?.useAsTitle || 'id'\n\n // Fetch the parent item and breadcrumbs (skip for root level)\n let parent: null | (Record<string, unknown> & TypeWithID) = null\n let breadcrumbs: Array<{ id: number | string; title: string }> = []\n\n if (parentId !== null) {\n try {\n const [item, ancestors] = await Promise.all([\n req.payload.findByID({\n id: parentId,\n collection: collectionSlug,\n depth: 0,\n overrideAccess: false,\n req,\n user,\n }),\n getAncestors({\n id: parentId,\n collectionSlug,\n req,\n }),\n ])\n\n parent = item\n breadcrumbs = ancestors\n } catch (_error) {\n req.payload.logger.warn({\n msg: `Hierarchy item not found: ${parentId}`,\n })\n }\n }\n\n // Build children where clause\n // For root level (parentId is null), find items without a parent\n // For nested level, find items with this specific parent\n const parentCondition =\n parentId === null\n ? {\n or: [{ [parentFieldName]: { exists: false } }, { [parentFieldName]: { equals: null } }],\n }\n : { [parentFieldName]: { equals: parentId } }\n\n // Build type filter condition if typeFilter is provided and collectionSpecific is configured\n // Filter to folders that allow ANY of the selected types OR are unrestricted\n let typeCondition: Record<string, unknown> | undefined\n\n if (\n typeFilter &&\n typeFilter.length > 0 &&\n hierarchyConfig.collectionSpecific &&\n typeof hierarchyConfig.collectionSpecific === 'object'\n ) {\n const typeFieldName = hierarchyConfig.collectionSpecific.fieldName\n // Exclude the hierarchy collection itself from the filter (folders always show folders)\n const filteredTypes = typeFilter.filter((t) => t !== collectionSlug)\n\n if (filteredTypes.length > 0) {\n typeCondition = {\n or: [\n { [typeFieldName]: { in: filteredTypes } },\n { [typeFieldName]: { exists: false } }, // Include unrestricted folders\n ],\n }\n }\n }\n\n // Combine conditions: parent + search + typeFilter\n const conditions: Record<string, unknown>[] = [parentCondition]\n\n if (search) {\n conditions.push({ [useAsTitle]: { like: search } })\n }\n\n if (typeCondition) {\n conditions.push(typeCondition)\n }\n\n const childrenWhere = conditions.length > 1 ? { and: conditions } : parentCondition\n\n // Fetch children (hierarchy items with this parent, or root items if parentId is null)\n const childrenData = await req.payload.find({\n collection: collectionSlug,\n depth: 0,\n draft: true,\n fallbackLocale: false,\n includeLockStatus: true,\n limit: DEFAULT_HIERARCHY_LIST_LIMIT,\n locale: req.locale,\n overrideAccess: false,\n page: 1,\n req,\n user,\n where: combineWhereConstraints([childrenWhere, baseFilter]),\n })\n\n // Fetch related documents from other collections\n // At root level: show unassigned documents (where hierarchy field doesn't exist)\n // At nested level: show documents assigned to the selected hierarchy item\n const relatedDocumentsByCollection: RelatedDocumentsGrouped = {}\n const relatedBaseFilters: Record<string, Where> = {}\n\n // Use pre-computed relatedCollections from sanitized hierarchy config\n const relatedCollectionsConfig = hierarchyConfig.relatedCollections || {}\n\n for (const [relatedSlug, fieldInfo] of Object.entries(relatedCollectionsConfig)) {\n if (relatedSlug === collectionSlug) {\n continue\n }\n\n const relatedCollectionConfig = req.payload.collections[relatedSlug]?.config\n if (!relatedCollectionConfig) {\n continue\n }\n\n // Check if user has read permission for this collection\n if (!permissions?.collections?.[relatedSlug]?.read) {\n continue\n }\n\n const { fieldName, hasMany } = fieldInfo\n\n // Get baseFilter for this related collection\n const relatedBaseFilter = await (\n relatedCollectionConfig.admin?.baseFilter ?? relatedCollectionConfig.admin?.baseListFilter\n )?.({\n limit: DEFAULT_HIERARCHY_LIST_LIMIT,\n page: 1,\n req,\n sort: undefined,\n })\n\n if (relatedBaseFilter) {\n relatedBaseFilters[relatedSlug] = relatedBaseFilter\n }\n\n // Build where clause based on whether we're at root or nested level\n let relationshipWhere: Record<string, unknown>\n\n if (parentId === null) {\n // Root level: find documents where hierarchy field doesn't exist, is null, or is empty array\n const conditions: Record<string, unknown>[] = [\n { [fieldName]: { exists: false } },\n { [fieldName]: { equals: null } },\n ]\n if (hasMany) {\n // hasMany fields store cleared values as empty arrays\n conditions.push({ [fieldName]: { equals: [] } })\n }\n relationshipWhere = { or: conditions }\n } else {\n // Nested level: find documents assigned to this hierarchy item\n // \"in\" operator works for both hasMany and single relationship fields\n relationshipWhere = {\n [fieldName]: { in: [parentId] },\n }\n }\n\n // Add search filter if provided\n const relatedUseAsTitle = relatedCollectionConfig.admin?.useAsTitle || 'id'\n const whereWithSearch = search\n ? { and: [relationshipWhere, { [relatedUseAsTitle]: { like: search } }] }\n : relationshipWhere\n\n // Combine relationship where with related collection's baseFilter\n const where = combineWhereConstraints([whereWithSearch, relatedBaseFilter])\n\n try {\n const data = await req.payload.find({\n collection: relatedSlug,\n depth: 0,\n draft: true,\n fallbackLocale: false,\n includeLockStatus: true,\n limit: DEFAULT_HIERARCHY_LIST_LIMIT,\n locale: req.locale,\n overrideAccess: false,\n page: 1,\n req,\n user,\n where,\n })\n\n if (data.totalDocs > 0) {\n relatedDocumentsByCollection[relatedSlug] = {\n hasMany,\n label: getTranslation(relatedCollectionConfig.labels?.plural, req.i18n),\n result: data,\n }\n }\n } catch (error) {\n req.payload.logger.warn({\n err: error,\n msg: `Failed to query related collection ${relatedSlug}`,\n })\n }\n }\n\n // Extract allowed collections from parent's collectionSpecific field\n // - undefined: collectionSpecific not configured, no filtering needed\n // - []: parent folder accepts everything, can only move to unrestricted destinations\n // - [{ slug, label }, ...]: parent folder has restrictions\n let allowedCollections: Array<{ label: string; slug: string }> | undefined\n\n if (hierarchyConfig.collectionSpecific && parent) {\n const typeFieldName = hierarchyConfig.collectionSpecific.fieldName\n const typeValues = parent[typeFieldName] as null | string[] | undefined\n\n if (typeValues && typeValues.length > 0) {\n allowedCollections = typeValues.map((slug) => {\n const config = req.payload.collections[slug]?.config\n const label = config ? getTranslation(config.labels?.plural, req.i18n) : slug\n return { slug, label }\n })\n } else {\n // Parent folder accepts everything (type is null or empty)\n allowedCollections = []\n }\n }\n\n return {\n allowedCollections,\n breadcrumbs,\n childrenData,\n parent,\n parentFieldName,\n parentId,\n relatedBaseFilters: Object.keys(relatedBaseFilters).length > 0 ? relatedBaseFilters : undefined,\n relatedDocumentsByCollection,\n }\n}\n"],"mappings":"AAUA,SAASA,cAAc,QAAQ;AAC/B,SAASC,YAAY,QAAQ;AAC7B,SAASC,uBAAuB,EAAEC,4BAA4B,QAAQ;AAEtE;;;;AAIA,OAAO,MAAMC,eAAA,GAAkB,MAAAA,CAAO;EACpCC,UAAU;EACVC,gBAAgB;EAChBC,cAAc;EACdC,QAAQ;EACRC,WAAW;EACXC,GAAG;EACHC,MAAM;EACNC,UAAU;EACVC;AAAI,CAYL;EACC,MAAMC,eAAA,GACJR,gBAAA,CAAiBS,SAAS,IAAI,OAAOT,gBAAA,CAAiBS,SAAS,KAAK,WAChET,gBAAA,CAAiBS,SAAS,GAC1BC,SAAA;EAEN,IAAI,CAACF,eAAA,EAAiB;IACpB,MAAM,IAAIG,KAAA,CAAM;EAClB;EAEA,MAAMC,eAAA,GAAkBJ,eAAA,CAAgBI,eAAe;EAEvD,MAAMC,UAAA,GAAab,gBAAA,CAAiBc,KAAK,EAAED,UAAA,IAAc;EAEzD;EACA,IAAIE,MAAA,GAAwD;EAC5D,IAAIC,WAAA,GAA6D,EAAE;EAEnE,IAAId,QAAA,KAAa,MAAM;IACrB,IAAI;MACF,MAAM,CAACe,IAAA,EAAMC,SAAA,CAAU,GAAG,MAAMC,OAAA,CAAQC,GAAG,CAAC,CAC1ChB,GAA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