@payloadcms/ui 3.80.0-internal.21e9c47 → 3.80.0-internal.8d9ec7c

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 (94) hide show
  1. package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.d.ts.map +1 -1
  2. package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.js +49 -1
  3. package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.js.map +1 -1
  4. package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.spec.js +384 -0
  5. package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.spec.js.map +1 -0
  6. package/dist/elements/Combobox/index.d.ts.map +1 -1
  7. package/dist/elements/Combobox/index.js +1 -0
  8. package/dist/elements/Combobox/index.js.map +1 -1
  9. package/dist/elements/HierarchyColumnBrowser/index.d.ts +1 -1
  10. package/dist/elements/HierarchyColumnBrowser/index.d.ts.map +1 -1
  11. package/dist/elements/HierarchyColumnBrowser/index.js +6 -3
  12. package/dist/elements/HierarchyColumnBrowser/index.js.map +1 -1
  13. package/dist/elements/HierarchyColumnBrowser/types.d.ts +3 -0
  14. package/dist/elements/HierarchyColumnBrowser/types.d.ts.map +1 -1
  15. package/dist/elements/HierarchyColumnBrowser/types.js.map +1 -1
  16. package/dist/elements/HierarchyDrawer/Drawer/index.d.ts +1 -1
  17. package/dist/elements/HierarchyDrawer/Drawer/index.d.ts.map +1 -1
  18. package/dist/elements/HierarchyDrawer/Drawer/index.js +2 -0
  19. package/dist/elements/HierarchyDrawer/Drawer/index.js.map +1 -1
  20. package/dist/elements/HierarchyDrawer/index.d.ts.map +1 -1
  21. package/dist/elements/HierarchyDrawer/index.js +4 -2
  22. package/dist/elements/HierarchyDrawer/index.js.map +1 -1
  23. package/dist/elements/HierarchyDrawer/types.d.ts +3 -0
  24. package/dist/elements/HierarchyDrawer/types.d.ts.map +1 -1
  25. package/dist/elements/HierarchyDrawer/types.js.map +1 -1
  26. package/dist/elements/HierarchyTree/HierarchySidebarTab.d.ts +1 -0
  27. package/dist/elements/HierarchyTree/HierarchySidebarTab.d.ts.map +1 -1
  28. package/dist/elements/HierarchyTree/HierarchySidebarTab.js +47 -36
  29. package/dist/elements/HierarchyTree/HierarchySidebarTab.js.map +1 -1
  30. package/dist/elements/HierarchyTree/HierarchySidebarTab.server.d.ts.map +1 -1
  31. package/dist/elements/HierarchyTree/HierarchySidebarTab.server.js +14 -5
  32. package/dist/elements/HierarchyTree/HierarchySidebarTab.server.js.map +1 -1
  33. package/dist/elements/HierarchyTree/index.d.ts.map +1 -1
  34. package/dist/elements/HierarchyTree/index.js +2 -0
  35. package/dist/elements/HierarchyTree/index.js.map +1 -1
  36. package/dist/elements/HierarchyTree/types.d.ts +3 -1
  37. package/dist/elements/HierarchyTree/types.d.ts.map +1 -1
  38. package/dist/elements/HierarchyTree/types.js.map +1 -1
  39. package/dist/elements/HydrateHierarchyProvider/index.d.ts.map +1 -1
  40. package/dist/elements/HydrateHierarchyProvider/index.js +22 -19
  41. package/dist/elements/HydrateHierarchyProvider/index.js.map +1 -1
  42. package/dist/elements/Link/index.d.ts.map +1 -1
  43. package/dist/elements/PublishButton/index.d.ts.map +1 -1
  44. package/dist/elements/PublishButton/index.js +3 -1
  45. package/dist/elements/PublishButton/index.js.map +1 -1
  46. package/dist/elements/Toasts/fieldErrors.d.ts +4 -0
  47. package/dist/elements/Toasts/fieldErrors.d.ts.map +1 -1
  48. package/dist/elements/Toasts/fieldErrors.js +4 -2
  49. package/dist/elements/Toasts/fieldErrors.js.map +1 -1
  50. package/dist/elements/Toasts/fieldErrors.spec.js +46 -0
  51. package/dist/elements/Toasts/fieldErrors.spec.js.map +1 -0
  52. package/dist/elements/Tree/TreeNode/index.d.ts +1 -1
  53. package/dist/elements/Tree/TreeNode/index.d.ts.map +1 -1
  54. package/dist/elements/Tree/TreeNode/index.js +3 -0
  55. package/dist/elements/Tree/TreeNode/index.js.map +1 -1
  56. package/dist/elements/Tree/index.d.ts.map +1 -1
  57. package/dist/elements/Tree/index.js +54 -42
  58. package/dist/elements/Tree/index.js.map +1 -1
  59. package/dist/elements/Tree/types.d.ts +3 -0
  60. package/dist/elements/Tree/types.d.ts.map +1 -1
  61. package/dist/elements/Tree/types.js.map +1 -1
  62. package/dist/elements/Tree/useChildren.d.ts +4 -1
  63. package/dist/elements/Tree/useChildren.d.ts.map +1 -1
  64. package/dist/elements/Tree/useChildren.js +8 -8
  65. package/dist/elements/Tree/useChildren.js.map +1 -1
  66. package/dist/elements/WhereBuilder/Condition/Relationship/index.d.ts.map +1 -1
  67. package/dist/elements/WhereBuilder/Condition/Relationship/index.js +8 -6
  68. package/dist/elements/WhereBuilder/Condition/Relationship/index.js.map +1 -1
  69. package/dist/elements/WhereBuilder/field-types.d.ts.map +1 -1
  70. package/dist/elements/WhereBuilder/field-types.js +2 -5
  71. package/dist/elements/WhereBuilder/field-types.js.map +1 -1
  72. package/dist/exports/client/{DatePicker-CL2EGBVQ.js → DatePicker-T2DMDMM5.js} +2 -2
  73. package/dist/exports/client/chunk-WDZJLNNB.js +29 -0
  74. package/dist/exports/client/{chunk-SH42NW5R.js.map → chunk-WDZJLNNB.js.map} +4 -4
  75. package/dist/exports/client/index.js +14 -14
  76. package/dist/exports/client/index.js.map +4 -4
  77. package/dist/providers/Hierarchy/index.d.ts.map +1 -1
  78. package/dist/providers/Hierarchy/index.js +12 -3
  79. package/dist/providers/Hierarchy/index.js.map +1 -1
  80. package/dist/providers/Hierarchy/types.d.ts +5 -1
  81. package/dist/providers/Hierarchy/types.d.ts.map +1 -1
  82. package/dist/providers/Hierarchy/types.js.map +1 -1
  83. package/dist/views/Edit/index.js +1 -1
  84. package/dist/views/Edit/index.js.map +1 -1
  85. package/dist/views/HierarchyList/HierarchyTable/index.d.ts +6 -2
  86. package/dist/views/HierarchyList/HierarchyTable/index.d.ts.map +1 -1
  87. package/dist/views/HierarchyList/HierarchyTable/index.js +19 -18
  88. package/dist/views/HierarchyList/HierarchyTable/index.js.map +1 -1
  89. package/dist/views/HierarchyList/index.d.ts.map +1 -1
  90. package/dist/views/HierarchyList/index.js +3 -1
  91. package/dist/views/HierarchyList/index.js.map +1 -1
  92. package/package.json +5 -5
  93. package/dist/exports/client/chunk-SH42NW5R.js +0 -29
  94. /package/dist/exports/client/{DatePicker-CL2EGBVQ.js.map → DatePicker-T2DMDMM5.js.map} +0 -0
@@ -12,8 +12,9 @@ import { useHierarchy } from '../../providers/Hierarchy/index.js';
12
12
  import { useRouteTransition } from '../../providers/RouteTransition/index.js';
13
13
  import { HierarchyTree } from './index.js';
14
14
  export const HierarchySidebarTab = t0 => {
15
- const $ = _c(30);
15
+ const $ = _c(32);
16
16
  const {
17
+ baseFilter,
17
18
  collectionSpecificOptions,
18
19
  hierarchyCollectionSlug,
19
20
  icon,
@@ -51,30 +52,36 @@ export const HierarchySidebarTab = t0 => {
51
52
  }
52
53
  const [selectedFilters, setSelectedFiltersLocal] = useState(t3);
53
54
  const {
55
+ baseFilter: contextBaseFilter,
54
56
  setSelectedFilters: setSelectedFiltersContext,
55
57
  treeRefreshKey,
56
58
  viewCollectionSlug
57
59
  } = useHierarchy();
58
60
  let t4;
59
- if ($[2] !== adminRoute || $[3] !== collectionSpecificOptions || $[4] !== hierarchyCollectionSlug || $[5] !== icon || $[6] !== initialData || $[7] !== initialExpandedNodes || $[8] !== initialSelectedFilters || $[9] !== isSearchActive || $[10] !== parentFieldName || $[11] !== router || $[12] !== searchParams || $[13] !== selectedFilters || $[14] !== selectedNodeIdFromServer || $[15] !== setSelectedFiltersContext || $[16] !== startRouteTransition || $[17] !== treeLimit || $[18] !== treeRefreshKey || $[19] !== typeFieldName || $[20] !== useAsTitle || $[21] !== viewCollectionSlug) {
61
+ if ($[2] !== adminRoute || $[3] !== baseFilter || $[4] !== collectionSpecificOptions || $[5] !== contextBaseFilter || $[6] !== hierarchyCollectionSlug || $[7] !== icon || $[8] !== initialData || $[9] !== initialExpandedNodes || $[10] !== initialSelectedFilters || $[11] !== isSearchActive || $[12] !== parentFieldName || $[13] !== router || $[14] !== searchParams || $[15] !== selectedFilters || $[16] !== selectedNodeIdFromServer || $[17] !== setSelectedFiltersContext || $[18] !== startRouteTransition || $[19] !== treeLimit || $[20] !== treeRefreshKey || $[21] !== typeFieldName || $[22] !== useAsTitle || $[23] !== viewCollectionSlug) {
60
62
  const parentParam = searchParams.get("parent");
61
63
  const isViewingThisCollection = viewCollectionSlug === hierarchyCollectionSlug;
62
64
  const selectedNodeId = isViewingThisCollection ? parentParam ?? selectedNodeIdFromServer ?? undefined : undefined;
63
- const effectiveInitialData = treeRefreshKey === 0 ? initialData : null;
65
+ const baseFilterKey = baseFilter ? JSON.stringify(baseFilter) : "";
66
+ const contextBaseFilterKey = contextBaseFilter ? JSON.stringify(contextBaseFilter) : "";
67
+ const contextHasNewerBaseFilter = contextBaseFilter !== null && baseFilterKey !== contextBaseFilterKey;
68
+ const effectiveInitialData = treeRefreshKey === 0 && !contextHasNewerBaseFilter ? initialData : null;
69
+ const effectiveBaseFilter = contextHasNewerBaseFilter ? contextBaseFilter : baseFilter;
70
+ const effectiveBaseFilterKey = contextHasNewerBaseFilter ? contextBaseFilterKey : baseFilterKey;
64
71
  let t5;
65
- if ($[23] !== setSelectedFiltersContext) {
72
+ if ($[25] !== setSelectedFiltersContext) {
66
73
  t5 = filters => {
67
74
  setSelectedFiltersLocal(filters);
68
75
  setSelectedFiltersContext(filters);
69
76
  };
70
- $[23] = setSelectedFiltersContext;
71
- $[24] = t5;
77
+ $[25] = setSelectedFiltersContext;
78
+ $[26] = t5;
72
79
  } else {
73
- t5 = $[24];
80
+ t5 = $[26];
74
81
  }
75
82
  const handleFilterChange = t5;
76
83
  let t6;
77
- if ($[25] !== adminRoute || $[26] !== hierarchyCollectionSlug || $[27] !== router || $[28] !== startRouteTransition) {
84
+ if ($[27] !== adminRoute || $[28] !== hierarchyCollectionSlug || $[29] !== router || $[30] !== startRouteTransition) {
78
85
  t6 = t7 => {
79
86
  const {
80
87
  id
@@ -88,17 +95,18 @@ export const HierarchySidebarTab = t0 => {
88
95
  router.refresh();
89
96
  });
90
97
  };
91
- $[25] = adminRoute;
92
- $[26] = hierarchyCollectionSlug;
93
- $[27] = router;
94
- $[28] = startRouteTransition;
95
- $[29] = t6;
98
+ $[27] = adminRoute;
99
+ $[28] = hierarchyCollectionSlug;
100
+ $[29] = router;
101
+ $[30] = startRouteTransition;
102
+ $[31] = t6;
96
103
  } else {
97
- t6 = $[29];
104
+ t6 = $[31];
98
105
  }
99
106
  const handleNavigateToParent = t6;
100
107
  t4 = _jsxs(_Fragment, {
101
108
  children: [_jsx(HydrateHierarchyProvider, {
109
+ baseFilter: contextHasNewerBaseFilter ? undefined : baseFilter,
102
110
  collectionSlug: hierarchyCollectionSlug,
103
111
  expandedNodes: initialExpandedNodes,
104
112
  parentFieldName,
@@ -117,6 +125,7 @@ export const HierarchySidebarTab = t0 => {
117
125
  onSelect: handleNavigateToParent,
118
126
  selectedFilters
119
127
  }), !isSearchActive && _jsx(HierarchyTree, {
128
+ baseFilter: effectiveBaseFilter,
120
129
  collectionSlug: hierarchyCollectionSlug,
121
130
  filterByCollections: selectedFilters.length > 0 ? selectedFilters : undefined,
122
131
  icon,
@@ -124,32 +133,34 @@ export const HierarchySidebarTab = t0 => {
124
133
  onNodeClick: handleNavigateToParent,
125
134
  selectedNodeId,
126
135
  useAsTitle
127
- }, `${hierarchyCollectionSlug}-${treeRefreshKey}`)]
136
+ }, `${hierarchyCollectionSlug}-${treeRefreshKey}-${effectiveBaseFilterKey}`)]
128
137
  })]
129
138
  });
130
139
  $[2] = adminRoute;
131
- $[3] = collectionSpecificOptions;
132
- $[4] = hierarchyCollectionSlug;
133
- $[5] = icon;
134
- $[6] = initialData;
135
- $[7] = initialExpandedNodes;
136
- $[8] = initialSelectedFilters;
137
- $[9] = isSearchActive;
138
- $[10] = parentFieldName;
139
- $[11] = router;
140
- $[12] = searchParams;
141
- $[13] = selectedFilters;
142
- $[14] = selectedNodeIdFromServer;
143
- $[15] = setSelectedFiltersContext;
144
- $[16] = startRouteTransition;
145
- $[17] = treeLimit;
146
- $[18] = treeRefreshKey;
147
- $[19] = typeFieldName;
148
- $[20] = useAsTitle;
149
- $[21] = viewCollectionSlug;
150
- $[22] = t4;
140
+ $[3] = baseFilter;
141
+ $[4] = collectionSpecificOptions;
142
+ $[5] = contextBaseFilter;
143
+ $[6] = hierarchyCollectionSlug;
144
+ $[7] = icon;
145
+ $[8] = initialData;
146
+ $[9] = initialExpandedNodes;
147
+ $[10] = initialSelectedFilters;
148
+ $[11] = isSearchActive;
149
+ $[12] = parentFieldName;
150
+ $[13] = router;
151
+ $[14] = searchParams;
152
+ $[15] = selectedFilters;
153
+ $[16] = selectedNodeIdFromServer;
154
+ $[17] = setSelectedFiltersContext;
155
+ $[18] = startRouteTransition;
156
+ $[19] = treeLimit;
157
+ $[20] = treeRefreshKey;
158
+ $[21] = typeFieldName;
159
+ $[22] = useAsTitle;
160
+ $[23] = viewCollectionSlug;
161
+ $[24] = t4;
151
162
  } else {
152
- t4 = $[22];
163
+ t4 = $[24];
153
164
  }
154
165
  return t4;
155
166
  };
@@ -1 +1 @@
1
- {"version":3,"file":"HierarchySidebarTab.js","names":["c","_c","useRouter","useSearchParams","formatAdminURL","React","useCallback","useState","HierarchySearch","HydrateHierarchyProvider","useConfig","useHierarchy","useRouteTransition","HierarchyTree","HierarchySidebarTab","t0","$","collectionSpecificOptions","hierarchyCollectionSlug","icon","initialData","initialExpandedNodes","initialSelectedFilters","parentFieldName","selectedNodeId","selectedNodeIdFromServer","treeLimit","typeFieldName","useAsTitle","router","searchParams","startRouteTransition","config","t1","routes","t2","admin","adminRoute","isSearchActive","setIsSearchActive","t3","selectedFilters","setSelectedFiltersLocal","setSelectedFilters","setSelectedFiltersContext","treeRefreshKey","viewCollectionSlug","t4","parentParam","get","isViewingThisCollection","undefined","effectiveInitialData","t5","filters","handleFilterChange","t6","t7","id","url","path","push","refresh","handleNavigateToParent","_jsxs","_Fragment","children","_jsx","collectionSlug","expandedNodes","treeData","className","isActive","onActiveChange","onFilterChange","onSelect","filterByCollections","length","onNodeClick"],"sources":["../../../src/elements/HierarchyTree/HierarchySidebarTab.tsx"],"sourcesContent":["'use client'\n\nimport type { SidebarTabClientProps } from 'payload'\n\nimport { useRouter, useSearchParams } from 'next/navigation.js'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { useCallback, useState } from 'react'\n\nimport type { HierarchyInitialData } from './types.js'\n\nimport { HierarchySearch } from '../../elements/HierarchySearch/index.js'\nimport { HydrateHierarchyProvider } from '../../elements/HydrateHierarchyProvider/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useHierarchy } from '../../providers/Hierarchy/index.js'\nimport { useRouteTransition } from '../../providers/RouteTransition/index.js'\nimport { HierarchyTree } from './index.js'\n\nexport const HierarchySidebarTab: React.FC<\n {\n collectionSpecificOptions?: { label: string; value: string }[]\n hierarchyCollectionSlug: string\n icon?: React.ReactNode\n initialData?: HierarchyInitialData | null\n initialExpandedNodes?: (number | string)[]\n initialSelectedFilters?: string[]\n parentFieldName?: string\n selectedNodeId?: null | string\n treeLimit?: number\n typeFieldName?: string\n useAsTitle?: string\n } & SidebarTabClientProps\n> = ({\n collectionSpecificOptions,\n hierarchyCollectionSlug,\n icon,\n initialData,\n initialExpandedNodes,\n initialSelectedFilters,\n parentFieldName,\n selectedNodeId: selectedNodeIdFromServer,\n treeLimit,\n typeFieldName,\n useAsTitle,\n}) => {\n const router = useRouter()\n const searchParams = useSearchParams()\n const { startRouteTransition } = useRouteTransition()\n const {\n config: {\n routes: { admin: adminRoute },\n },\n } = useConfig()\n const [isSearchActive, setIsSearchActive] = useState(false)\n const [selectedFilters, setSelectedFiltersLocal] = useState<string[]>(\n initialSelectedFilters ?? [],\n )\n const {\n setSelectedFilters: setSelectedFiltersContext,\n treeRefreshKey,\n viewCollectionSlug,\n } = useHierarchy()\n\n // Only show selection if the current list view matches this tab's hierarchy collection\n const parentParam = searchParams.get('parent')\n const isViewingThisCollection = viewCollectionSlug === hierarchyCollectionSlug\n const selectedNodeId = isViewingThisCollection\n ? (parentParam ?? selectedNodeIdFromServer ?? undefined)\n : undefined\n\n // Only use initialData on first render - after refresh, fetch fresh data\n const effectiveInitialData = treeRefreshKey === 0 ? initialData : null\n\n const handleFilterChange = useCallback(\n (filters: string[]) => {\n setSelectedFiltersLocal(filters)\n setSelectedFiltersContext(filters)\n },\n [setSelectedFiltersContext],\n )\n\n const handleNavigateToParent = useCallback(\n ({ id }: { id: number | string }) => {\n const url = formatAdminURL({\n adminRoute,\n path: `/collections/${hierarchyCollectionSlug}?parent=${id}`,\n })\n startRouteTransition(() => {\n router.push(url)\n router.refresh()\n })\n },\n [adminRoute, hierarchyCollectionSlug, router, startRouteTransition],\n )\n return (\n <>\n <HydrateHierarchyProvider\n collectionSlug={hierarchyCollectionSlug}\n expandedNodes={initialExpandedNodes}\n parentFieldName={parentFieldName}\n selectedFilters={initialSelectedFilters}\n treeData={effectiveInitialData}\n treeLimit={treeLimit}\n typeFieldName={typeFieldName}\n />\n <div className=\"hierarchy-sidebar-tab\">\n <HierarchySearch\n collectionSlug={hierarchyCollectionSlug}\n collectionSpecificOptions={collectionSpecificOptions}\n isActive={isSearchActive}\n onActiveChange={setIsSearchActive}\n onFilterChange={handleFilterChange}\n onSelect={handleNavigateToParent}\n selectedFilters={selectedFilters}\n />\n {!isSearchActive && (\n <HierarchyTree\n collectionSlug={hierarchyCollectionSlug}\n filterByCollections={selectedFilters.length > 0 ? selectedFilters : undefined}\n icon={icon}\n initialData={effectiveInitialData}\n key={`${hierarchyCollectionSlug}-${treeRefreshKey}`}\n onNodeClick={handleNavigateToParent}\n selectedNodeId={selectedNodeId}\n useAsTitle={useAsTitle}\n />\n )}\n </div>\n </>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,SAASC,SAAS,EAAEC,eAAe,QAAQ;AAC3C,SAASC,cAAc,QAAQ;AA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;;;;;;;;;;;SA1B3DE,E;CAmCJ","ignoreList":[]}
1
+ {"version":3,"file":"HierarchySidebarTab.js","names":["c","_c","useRouter","useSearchParams","formatAdminURL","React","useCallback","useState","HierarchySearch","HydrateHierarchyProvider","useConfig","useHierarchy","useRouteTransition","HierarchyTree","HierarchySidebarTab","t0","$","baseFilter","collectionSpecificOptions","hierarchyCollectionSlug","icon","initialData","initialExpandedNodes","initialSelectedFilters","parentFieldName","selectedNodeId","selectedNodeIdFromServer","treeLimit","typeFieldName","useAsTitle","router","searchParams","startRouteTransition","config","t1","routes","t2","admin","adminRoute","isSearchActive","setIsSearchActive","t3","selectedFilters","setSelectedFiltersLocal","contextBaseFilter","setSelectedFilters","setSelectedFiltersContext","treeRefreshKey","viewCollectionSlug","t4","parentParam","get","isViewingThisCollection","undefined","baseFilterKey","JSON","stringify","contextBaseFilterKey","contextHasNewerBaseFilter","effectiveInitialData","effectiveBaseFilter","effectiveBaseFilterKey","t5","filters","handleFilterChange","t6","t7","id","url","path","push","refresh","handleNavigateToParent","_jsxs","_Fragment","children","_jsx","collectionSlug","expandedNodes","treeData","className","isActive","onActiveChange","onFilterChange","onSelect","filterByCollections","length","onNodeClick"],"sources":["../../../src/elements/HierarchyTree/HierarchySidebarTab.tsx"],"sourcesContent":["'use client'\n\nimport type { SidebarTabClientProps } from 'payload'\n\nimport { useRouter, useSearchParams } from 'next/navigation.js'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { useCallback, useState } from 'react'\n\nimport type { HierarchyInitialData } from './types.js'\n\nimport { HierarchySearch } from '../../elements/HierarchySearch/index.js'\nimport { HydrateHierarchyProvider } from '../../elements/HydrateHierarchyProvider/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useHierarchy } from '../../providers/Hierarchy/index.js'\nimport { useRouteTransition } from '../../providers/RouteTransition/index.js'\nimport { HierarchyTree } from './index.js'\n\nexport const HierarchySidebarTab: React.FC<\n {\n baseFilter?: Record<string, unknown>\n collectionSpecificOptions?: { label: string; value: string }[]\n hierarchyCollectionSlug: string\n icon?: React.ReactNode\n initialData?: HierarchyInitialData | null\n initialExpandedNodes?: (number | string)[]\n initialSelectedFilters?: string[]\n parentFieldName?: string\n selectedNodeId?: null | string\n treeLimit?: number\n typeFieldName?: string\n useAsTitle?: string\n } & SidebarTabClientProps\n> = ({\n baseFilter,\n collectionSpecificOptions,\n hierarchyCollectionSlug,\n icon,\n initialData,\n initialExpandedNodes,\n initialSelectedFilters,\n parentFieldName,\n selectedNodeId: selectedNodeIdFromServer,\n treeLimit,\n typeFieldName,\n useAsTitle,\n}) => {\n const router = useRouter()\n const searchParams = useSearchParams()\n const { startRouteTransition } = useRouteTransition()\n const {\n config: {\n routes: { admin: adminRoute },\n },\n } = useConfig()\n const [isSearchActive, setIsSearchActive] = useState(false)\n const [selectedFilters, setSelectedFiltersLocal] = useState<string[]>(\n initialSelectedFilters ?? [],\n )\n const {\n baseFilter: contextBaseFilter,\n setSelectedFilters: setSelectedFiltersContext,\n treeRefreshKey,\n viewCollectionSlug,\n } = useHierarchy()\n\n // Only show selection if the current list view matches this tab's hierarchy collection\n const parentParam = searchParams.get('parent')\n const isViewingThisCollection = viewCollectionSlug === hierarchyCollectionSlug\n const selectedNodeId = isViewingThisCollection\n ? (parentParam ?? selectedNodeIdFromServer ?? undefined)\n : undefined\n\n const baseFilterKey = baseFilter ? JSON.stringify(baseFilter) : ''\n const contextBaseFilterKey = contextBaseFilter ? JSON.stringify(contextBaseFilter) : ''\n\n // Context has a newer baseFilter if it exists and differs from props\n const contextHasNewerBaseFilter =\n contextBaseFilter !== null && baseFilterKey !== contextBaseFilterKey\n\n // Skip stale initialData when context has a newer baseFilter\n const effectiveInitialData =\n treeRefreshKey === 0 && !contextHasNewerBaseFilter ? initialData : null\n\n const effectiveBaseFilter = contextHasNewerBaseFilter ? contextBaseFilter : baseFilter\n const effectiveBaseFilterKey = contextHasNewerBaseFilter ? contextBaseFilterKey : baseFilterKey\n\n const handleFilterChange = useCallback(\n (filters: string[]) => {\n setSelectedFiltersLocal(filters)\n setSelectedFiltersContext(filters)\n },\n [setSelectedFiltersContext],\n )\n\n const handleNavigateToParent = useCallback(\n ({ id }: { id: number | string }) => {\n const url = formatAdminURL({\n adminRoute,\n path: `/collections/${hierarchyCollectionSlug}?parent=${id}`,\n })\n startRouteTransition(() => {\n router.push(url)\n router.refresh()\n })\n },\n [adminRoute, hierarchyCollectionSlug, router, startRouteTransition],\n )\n return (\n <>\n <HydrateHierarchyProvider\n baseFilter={contextHasNewerBaseFilter ? undefined : baseFilter}\n collectionSlug={hierarchyCollectionSlug}\n expandedNodes={initialExpandedNodes}\n parentFieldName={parentFieldName}\n selectedFilters={initialSelectedFilters}\n treeData={effectiveInitialData}\n treeLimit={treeLimit}\n typeFieldName={typeFieldName}\n />\n <div className=\"hierarchy-sidebar-tab\">\n <HierarchySearch\n collectionSlug={hierarchyCollectionSlug}\n collectionSpecificOptions={collectionSpecificOptions}\n isActive={isSearchActive}\n onActiveChange={setIsSearchActive}\n onFilterChange={handleFilterChange}\n onSelect={handleNavigateToParent}\n selectedFilters={selectedFilters}\n />\n {!isSearchActive && (\n <HierarchyTree\n baseFilter={effectiveBaseFilter}\n collectionSlug={hierarchyCollectionSlug}\n filterByCollections={selectedFilters.length > 0 ? selectedFilters : undefined}\n icon={icon}\n initialData={effectiveInitialData}\n key={`${hierarchyCollectionSlug}-${treeRefreshKey}-${effectiveBaseFilterKey}`}\n onNodeClick={handleNavigateToParent}\n selectedNodeId={selectedNodeId}\n useAsTitle={useAsTitle}\n />\n )}\n </div>\n </>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,SAASC,SAAS,EAAEC,eAAe,QAAQ;AAC3C,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,WAAW,EAAEC,QAAQ,QAAQ;AAI7C,SAASC,eAAe,QAAQ;AAChC,SAASC,wBAAwB,QAAQ;AACzC,SAASC,SAAS,QAAQ;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A,EAEN1C,cAAA;UAAA2C,cAAA,EACM1C,iBAAA;UAAA2C,cAAA,EACAnB,kBAAA;UAAAoB,QAAA,EACNZ,sBAAA;UAAA9B;QAAA,C,GAGX,CAACH,cAAA,IACAqC,IAAA,CAAA/D,aAAA;UAAAI,UAAA,EACc2C,mBAAA;UAAAiB,cAAA,EACI1D,uBAAA;UAAAkE,mBAAA,EACK3C,eAAA,CAAA4C,MAAA,IAAyB,GAAI5C,eAAA,GAAAW,SAAkB;UAAAjC,IAAA;UAAAC,WAAA,EAEvDsC,oBAAA;UAAA4B,WAAA,EAEAf,sBAAA;UAAA/C,cAAA;UAAAI;QAAA,GADR,GAAGV,uBAAA,IAA2B4B,cAAA,IAAkBc,sBAAA,EAAwB;MAAA,C;;;;;;;;;;;;;;;;;;;;;;;;;;;;SA5BrFZ,E;CAqCJ","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"HierarchySidebarTab.server.d.ts","sourceRoot":"","sources":["../../../src/elements/HierarchyTree/HierarchySidebarTab.server.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAKpD,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,MAAM,MAAM,8BAA8B,GAAG;IAC3C,uBAAuB,EAAE,MAAM,CAAA;CAChC,GAAG,qBAAqB,CAAA;AAEzB,eAAO,MAAM,yBAAyB,EAAE,KAAK,CAAC,EAAE,CAAC,8BAA8B,CA+K9E,CAAA"}
1
+ {"version":3,"file":"HierarchySidebarTab.server.d.ts","sourceRoot":"","sources":["../../../src/elements/HierarchyTree/HierarchySidebarTab.server.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAS,MAAM,SAAS,CAAA;AAK3D,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,MAAM,MAAM,8BAA8B,GAAG;IAC3C,uBAAuB,EAAE,MAAM,CAAA;CAChC,GAAG,qBAAqB,CAAA;AAEzB,eAAO,MAAM,yBAAyB,EAAE,KAAK,CAAC,EAAE,CAAC,8BAA8B,CAwL9E,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { getTranslation } from '@payloadcms/translations';
3
- import { createLocalReq, getInitialTreeData } from 'payload';
3
+ import { DEFAULT_HIERARCHY_TREE_LIMIT, getInitialTreeData } from 'payload';
4
4
  import { PREFERENCE_KEYS } from 'payload/shared';
5
5
  import React from 'react';
6
6
  // eslint-disable-next-line payload/no-imports-from-exports-dir -- Server component must reference exports dir for proper client boundary
@@ -11,6 +11,7 @@ export const HierarchySidebarTabServer = async ({
11
11
  hierarchyCollectionSlug,
12
12
  i18n,
13
13
  payload,
14
+ req,
14
15
  searchParams,
15
16
  user
16
17
  }) => {
@@ -26,6 +27,7 @@ export const HierarchySidebarTabServer = async ({
26
27
  let typeFieldName;
27
28
  let useAsTitle;
28
29
  let collectionSpecificOptions = [];
30
+ let baseFilter = null;
29
31
  // Get collection config and render icon (outside try block - doesn't need async)
30
32
  const collectionConfig = payload.collections[hierarchyCollectionSlug]?.config;
31
33
  const hierarchyConfig = collectionConfig?.hierarchy && typeof collectionConfig.hierarchy === 'object' ? collectionConfig.hierarchy : undefined;
@@ -126,11 +128,17 @@ export const HierarchySidebarTabServer = async ({
126
128
  ancestorIds.forEach(id => expandedSet.add(id));
127
129
  initialExpandedNodes = Array.from(expandedSet);
128
130
  }
129
- // STEP 3: Fetch tree data (root nodes + children of expanded nodes + selected node path)
130
- const req = await createLocalReq({
131
- user
132
- }, payload);
131
+ const baseFilterFn = collectionConfig?.admin?.baseFilter ?? collectionConfig?.admin?.baseListFilter;
132
+ if (baseFilterFn && req) {
133
+ baseFilter = (await baseFilterFn({
134
+ limit: DEFAULT_HIERARCHY_TREE_LIMIT,
135
+ page: 1,
136
+ req,
137
+ sort: 'id'
138
+ })) ?? null;
139
+ }
133
140
  initialData = await getInitialTreeData({
141
+ baseFilter,
134
142
  collectionSlug: hierarchyCollectionSlug,
135
143
  expandedNodeIds: initialExpandedNodes,
136
144
  ...(initialSelectedFilters.length > 0 && {
@@ -151,6 +159,7 @@ export const HierarchySidebarTabServer = async ({
151
159
  // Fall back to client-side fetching if server fetch fails
152
160
  }
153
161
  return /*#__PURE__*/_jsx(HierarchySidebarTab, {
162
+ baseFilter: baseFilter,
154
163
  collectionSpecificOptions: collectionSpecificOptions,
155
164
  hierarchyCollectionSlug: hierarchyCollectionSlug,
156
165
  icon: icon,
@@ -1 +1 @@
1
- {"version":3,"file":"HierarchySidebarTab.server.js","names":["getTranslation","createLocalReq","getInitialTreeData","PREFERENCE_KEYS","React","HierarchySidebarTab","TagIcon","RenderServerComponent","HierarchySidebarTabServer","hierarchyCollectionSlug","i18n","payload","searchParams","user","initialData","initialExpandedNodes","initialSelectedFilters","selectedNodeId","parentFieldName","treeLimit","typeFieldName","useAsTitle","collectionSpecificOptions","collectionConfig","collections","config","hierarchyConfig","hierarchy","undefined","IconComponent","admin","components","Icon","icon","Component","importMap","key","_jsx","color","parent","String","preferenceKey","HIERARCHY_TREE","docs","preferenceDocs","find","collection","limit","overrideAccess","where","and","equals","id","preferences","value","expandedNodes","selectedFilters","collectionSpecific","fieldName","relatedCollections","Object","keys","map","slug","relatedConfig","label","labels","plural","sort","a","b","localeCompare","selectedNodeParentId","ancestorIds","currentNodeId","isFirstIteration","node","findByID","depth","parentId","push","expandedSet","Set","forEach","add","Array","from","req","collectionSlug","expandedNodeIds","length","filterByCollections","error","logger","warn","err","msg"],"sources":["../../../src/elements/HierarchyTree/HierarchySidebarTab.server.tsx"],"sourcesContent":["import type { SidebarTabServerProps } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { createLocalReq, getInitialTreeData } from 'payload'\nimport { PREFERENCE_KEYS } from 'payload/shared'\nimport React from 'react'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir -- Server component must reference exports dir for proper client boundary\nimport { HierarchySidebarTab } from '../../exports/client/index.js'\nimport { TagIcon } from '../../icons/Tag/index.js'\nimport { RenderServerComponent } from '../RenderServerComponent/index.js'\n\nexport type HierarchySidebarTabServerProps = {\n hierarchyCollectionSlug: string\n} & SidebarTabServerProps\n\nexport const HierarchySidebarTabServer: React.FC<HierarchySidebarTabServerProps> = async ({\n hierarchyCollectionSlug,\n i18n,\n payload,\n searchParams,\n user,\n}) => {\n if (!user) {\n return null\n }\n\n let initialData = null\n let initialExpandedNodes: (number | string)[] = []\n let initialSelectedFilters: string[] = []\n let selectedNodeId: null | string = null\n let parentFieldName = 'parent'\n let treeLimit: number | undefined\n let typeFieldName: string | undefined\n let useAsTitle: string | undefined\n let collectionSpecificOptions: { label: string; value: string }[] = []\n\n // Get collection config and render icon (outside try block - doesn't need async)\n const collectionConfig = payload.collections[hierarchyCollectionSlug]?.config\n const hierarchyConfig =\n collectionConfig?.hierarchy && typeof collectionConfig.hierarchy === 'object'\n ? collectionConfig.hierarchy\n : undefined\n\n const IconComponent = hierarchyConfig?.admin?.components?.Icon\n const icon = IconComponent ? (\n RenderServerComponent({\n Component: IconComponent,\n importMap: payload.importMap,\n key: `hierarchy-sidebar-icon-${hierarchyCollectionSlug}`,\n })\n ) : (\n <TagIcon color=\"muted\" />\n )\n\n try {\n // Get selected node from URL (?parent=<id>)\n selectedNodeId = searchParams?.parent ? String(searchParams.parent) : null\n\n // STEP 1: Load user's expanded node preferences\n const preferenceKey = `${PREFERENCE_KEYS.HIERARCHY_TREE}-${hierarchyCollectionSlug}`\n\n const { docs: preferenceDocs } = await payload.find({\n collection: 'payload-preferences',\n limit: 1,\n overrideAccess: false,\n user,\n where: {\n and: [\n { key: { equals: preferenceKey } },\n { 'user.value': { equals: user.id } },\n { 'user.relationTo': { equals: user.collection } },\n ],\n },\n })\n\n const preferences = preferenceDocs[0]\n\n if (preferences?.value?.expandedNodes) {\n initialExpandedNodes = preferences.value.expandedNodes\n }\n\n if (preferences?.value?.selectedFilters) {\n initialSelectedFilters = preferences.value.selectedFilters\n }\n\n // STEP 2: Get remaining config values\n parentFieldName = hierarchyConfig?.parentFieldName\n treeLimit = hierarchyConfig?.admin?.treeLimit\n typeFieldName =\n hierarchyConfig?.collectionSpecific && typeof hierarchyConfig.collectionSpecific === 'object'\n ? hierarchyConfig.collectionSpecific.fieldName\n : undefined\n useAsTitle = collectionConfig?.admin?.useAsTitle\n\n // STEP 2.5: Build collection-specific options from related collections\n if (hierarchyConfig.collectionSpecific && hierarchyConfig?.relatedCollections) {\n collectionSpecificOptions = Object.keys(hierarchyConfig.relatedCollections)\n .map((slug) => {\n const relatedConfig = payload.collections[slug]?.config\n const label = relatedConfig?.labels?.plural ?? slug\n\n return {\n label: getTranslation(label, i18n),\n value: slug,\n }\n })\n .sort((a, b) => a.label.localeCompare(b.label))\n }\n\n // Track the immediate parent of the selected node (for ensuring siblings are loaded)\n let selectedNodeParentId: null | number | string = null\n\n // If there's a selected node, ensure its ancestor chain is expanded\n if (selectedNodeId) {\n // Walk up the parent chain to root\n const ancestorIds: (number | string)[] = []\n let currentNodeId: null | number | string = selectedNodeId\n let isFirstIteration = true\n\n while (currentNodeId) {\n try {\n const node = await payload.findByID({\n id: currentNodeId,\n collection: hierarchyCollectionSlug,\n depth: 0,\n overrideAccess: false,\n user,\n })\n\n const parentId = node?.[parentFieldName]\n\n // Capture the immediate parent of the selected node\n if (isFirstIteration) {\n selectedNodeParentId = parentId ?? null\n isFirstIteration = false\n }\n\n if (parentId) {\n ancestorIds.push(parentId)\n currentNodeId = parentId\n } else {\n currentNodeId = null\n }\n } catch {\n // Node not found or access denied\n break\n }\n }\n\n // Merge ancestor IDs with existing expanded nodes\n const expandedSet = new Set(initialExpandedNodes)\n ancestorIds.forEach((id) => expandedSet.add(id))\n initialExpandedNodes = Array.from(expandedSet)\n }\n\n // STEP 3: Fetch tree data (root nodes + children of expanded nodes + selected node path)\n const req = await createLocalReq({ user }, payload)\n\n initialData = await getInitialTreeData({\n collectionSlug: hierarchyCollectionSlug,\n expandedNodeIds: initialExpandedNodes,\n ...(initialSelectedFilters.length > 0 && { filterByCollections: initialSelectedFilters }),\n ...(treeLimit !== undefined && { limit: treeLimit }),\n req,\n selectedNodeId,\n selectedNodeParentId,\n })\n } catch (error) {\n payload.logger.warn({\n err: error,\n msg: `Failed to fetch hierarchy data for ${hierarchyCollectionSlug}`,\n })\n // Fall back to client-side fetching if server fetch fails\n }\n\n return (\n <HierarchySidebarTab\n collectionSpecificOptions={collectionSpecificOptions}\n hierarchyCollectionSlug={hierarchyCollectionSlug}\n icon={icon}\n initialData={initialData}\n initialExpandedNodes={initialExpandedNodes}\n initialSelectedFilters={initialSelectedFilters}\n parentFieldName={parentFieldName}\n selectedNodeId={selectedNodeId}\n treeLimit={treeLimit}\n typeFieldName={typeFieldName}\n useAsTitle={useAsTitle}\n />\n )\n}\n"],"mappings":";AAEA,SAASA,cAAc,QAAQ;AAC/B,SAASC,cAAc,EAAEC,kBAAkB,QAAQ;AACnD,SAASC,eAAe,QAAQ;AAChC,OAAOC,KAAA,MAAW;AAElB;AACA,SAASC,mBAAmB,QAAQ;AACpC,SAASC,OAAO,QAAQ;AACxB,SAASC,qBAAqB,QAAQ;AAMtC,OAAO,MAAMC,yBAAA,GAAsE,MAAAA,CAAO;EACxFC,uBAAuB;EACvBC,IAAI;EACJC,OAAO;EACPC,YAAY;EACZC;AAAI,CACL;EACC,IAAI,CAACA,IAAA,EAAM;IACT,OAAO;EACT;EAEA,IAAIC,WAAA,GAAc;EAClB,IAAIC,oBAAA,GAA4C,EAAE;EAClD,IAAIC,sBAAA,GAAmC,EAAE;EACzC,IAAIC,cAAA,GAAgC;EACpC,IAAIC,eAAA,GAAkB;EACtB,IAAIC,SAAA;EACJ,IAAIC,aAAA;EACJ,IAAIC,UAAA;EACJ,IAAIC,yBAAA,GAAgE,EAAE;EAEtE;EACA,MAAMC,gBAAA,GAAmBZ,OAAA,CAAQa,WAAW,CAACf,uBAAA,CAAwB,EAAEgB,MAAA;EACvE,MAAMC,eAAA,GACJH,gBAAA,EAAkBI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WAAA;IACbC,oBAAA,EAAsBA,oBAAA;IACtBC,sBAAA,EAAwBA,sBAAA;IACxBE,eAAA,EAAiBA,eAAA;IACjBD,cAAA,EAAgBA,cAAA;IAChBE,SAAA,EAAWA,SAAA;IACXC,aAAA,EAAeA,aAAA;IACfC,UAAA,EAAYA;;AAGlB","ignoreList":[]}
1
+ {"version":3,"file":"HierarchySidebarTab.server.js","names":["getTranslation","DEFAULT_HIERARCHY_TREE_LIMIT","getInitialTreeData","PREFERENCE_KEYS","React","HierarchySidebarTab","TagIcon","RenderServerComponent","HierarchySidebarTabServer","hierarchyCollectionSlug","i18n","payload","req","searchParams","user","initialData","initialExpandedNodes","initialSelectedFilters","selectedNodeId","parentFieldName","treeLimit","typeFieldName","useAsTitle","collectionSpecificOptions","baseFilter","collectionConfig","collections","config","hierarchyConfig","hierarchy","undefined","IconComponent","admin","components","Icon","icon","Component","importMap","key","_jsx","color","parent","String","preferenceKey","HIERARCHY_TREE","docs","preferenceDocs","find","collection","limit","overrideAccess","where","and","equals","id","preferences","value","expandedNodes","selectedFilters","collectionSpecific","fieldName","relatedCollections","Object","keys","map","slug","relatedConfig","label","labels","plural","sort","a","b","localeCompare","selectedNodeParentId","ancestorIds","currentNodeId","isFirstIteration","node","findByID","depth","parentId","push","expandedSet","Set","forEach","add","Array","from","baseFilterFn","baseListFilter","page","collectionSlug","expandedNodeIds","length","filterByCollections","error","logger","warn","err","msg"],"sources":["../../../src/elements/HierarchyTree/HierarchySidebarTab.server.tsx"],"sourcesContent":["import type { SidebarTabServerProps, Where } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { DEFAULT_HIERARCHY_TREE_LIMIT, getInitialTreeData } from 'payload'\nimport { PREFERENCE_KEYS } from 'payload/shared'\nimport React from 'react'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir -- Server component must reference exports dir for proper client boundary\nimport { HierarchySidebarTab } from '../../exports/client/index.js'\nimport { TagIcon } from '../../icons/Tag/index.js'\nimport { RenderServerComponent } from '../RenderServerComponent/index.js'\n\nexport type HierarchySidebarTabServerProps = {\n hierarchyCollectionSlug: string\n} & SidebarTabServerProps\n\nexport const HierarchySidebarTabServer: React.FC<HierarchySidebarTabServerProps> = async ({\n hierarchyCollectionSlug,\n i18n,\n payload,\n req,\n searchParams,\n user,\n}) => {\n if (!user) {\n return null\n }\n\n let initialData = null\n let initialExpandedNodes: (number | string)[] = []\n let initialSelectedFilters: string[] = []\n let selectedNodeId: null | string = null\n let parentFieldName = 'parent'\n let treeLimit: number | undefined\n let typeFieldName: string | undefined\n let useAsTitle: string | undefined\n let collectionSpecificOptions: { label: string; value: string }[] = []\n let baseFilter: null | Where = null\n\n // Get collection config and render icon (outside try block - doesn't need async)\n const collectionConfig = payload.collections[hierarchyCollectionSlug]?.config\n const hierarchyConfig =\n collectionConfig?.hierarchy && typeof collectionConfig.hierarchy === 'object'\n ? collectionConfig.hierarchy\n : undefined\n\n const IconComponent = hierarchyConfig?.admin?.components?.Icon\n const icon = IconComponent ? (\n RenderServerComponent({\n Component: IconComponent,\n importMap: payload.importMap,\n key: `hierarchy-sidebar-icon-${hierarchyCollectionSlug}`,\n })\n ) : (\n <TagIcon color=\"muted\" />\n )\n\n try {\n // Get selected node from URL (?parent=<id>)\n selectedNodeId = searchParams?.parent ? String(searchParams.parent) : null\n\n // STEP 1: Load user's expanded node preferences\n const preferenceKey = `${PREFERENCE_KEYS.HIERARCHY_TREE}-${hierarchyCollectionSlug}`\n\n const { docs: preferenceDocs } = await payload.find({\n collection: 'payload-preferences',\n limit: 1,\n overrideAccess: false,\n user,\n where: {\n and: [\n { key: { equals: preferenceKey } },\n { 'user.value': { equals: user.id } },\n { 'user.relationTo': { equals: user.collection } },\n ],\n },\n })\n\n const preferences = preferenceDocs[0]\n\n if (preferences?.value?.expandedNodes) {\n initialExpandedNodes = preferences.value.expandedNodes\n }\n\n if (preferences?.value?.selectedFilters) {\n initialSelectedFilters = preferences.value.selectedFilters\n }\n\n // STEP 2: Get remaining config values\n parentFieldName = hierarchyConfig?.parentFieldName\n treeLimit = hierarchyConfig?.admin?.treeLimit\n typeFieldName =\n hierarchyConfig?.collectionSpecific && typeof hierarchyConfig.collectionSpecific === 'object'\n ? hierarchyConfig.collectionSpecific.fieldName\n : undefined\n useAsTitle = collectionConfig?.admin?.useAsTitle\n\n // STEP 2.5: Build collection-specific options from related collections\n if (hierarchyConfig.collectionSpecific && hierarchyConfig?.relatedCollections) {\n collectionSpecificOptions = Object.keys(hierarchyConfig.relatedCollections)\n .map((slug) => {\n const relatedConfig = payload.collections[slug]?.config\n const label = relatedConfig?.labels?.plural ?? slug\n\n return {\n label: getTranslation(label, i18n),\n value: slug,\n }\n })\n .sort((a, b) => a.label.localeCompare(b.label))\n }\n\n // Track the immediate parent of the selected node (for ensuring siblings are loaded)\n let selectedNodeParentId: null | number | string = null\n\n // If there's a selected node, ensure its ancestor chain is expanded\n if (selectedNodeId) {\n // Walk up the parent chain to root\n const ancestorIds: (number | string)[] = []\n let currentNodeId: null | number | string = selectedNodeId\n let isFirstIteration = true\n\n while (currentNodeId) {\n try {\n const node = await payload.findByID({\n id: currentNodeId,\n collection: hierarchyCollectionSlug,\n depth: 0,\n overrideAccess: false,\n user,\n })\n\n const parentId = node?.[parentFieldName]\n\n // Capture the immediate parent of the selected node\n if (isFirstIteration) {\n selectedNodeParentId = parentId ?? null\n isFirstIteration = false\n }\n\n if (parentId) {\n ancestorIds.push(parentId)\n currentNodeId = parentId\n } else {\n currentNodeId = null\n }\n } catch {\n // Node not found or access denied\n break\n }\n }\n\n // Merge ancestor IDs with existing expanded nodes\n const expandedSet = new Set(initialExpandedNodes)\n ancestorIds.forEach((id) => expandedSet.add(id))\n initialExpandedNodes = Array.from(expandedSet)\n }\n\n const baseFilterFn =\n collectionConfig?.admin?.baseFilter ?? collectionConfig?.admin?.baseListFilter\n if (baseFilterFn && req) {\n baseFilter =\n (await baseFilterFn({ limit: DEFAULT_HIERARCHY_TREE_LIMIT, page: 1, req, sort: 'id' })) ??\n null\n }\n\n initialData = await getInitialTreeData({\n baseFilter,\n collectionSlug: hierarchyCollectionSlug,\n expandedNodeIds: initialExpandedNodes,\n ...(initialSelectedFilters.length > 0 && { filterByCollections: initialSelectedFilters }),\n ...(treeLimit !== undefined && { limit: treeLimit }),\n req,\n selectedNodeId,\n selectedNodeParentId,\n })\n } catch (error) {\n payload.logger.warn({\n err: error,\n msg: `Failed to fetch hierarchy data for ${hierarchyCollectionSlug}`,\n })\n // Fall back to client-side fetching if server fetch fails\n }\n\n return (\n <HierarchySidebarTab\n baseFilter={baseFilter}\n collectionSpecificOptions={collectionSpecificOptions}\n hierarchyCollectionSlug={hierarchyCollectionSlug}\n icon={icon}\n initialData={initialData}\n initialExpandedNodes={initialExpandedNodes}\n initialSelectedFilters={initialSelectedFilters}\n parentFieldName={parentFieldName}\n selectedNodeId={selectedNodeId}\n treeLimit={treeLimit}\n typeFieldName={typeFieldName}\n useAsTitle={useAsTitle}\n />\n )\n}\n"],"mappings":";AAEA,SAASA,cAAc,QAAQ;AAC/B,SAASC,4BAA4B,EAAEC,kBAAkB,QAAQ;AACjE,SAASC,eAAe,QAAQ;AAChC,OAAOC,KAAA,MAAW;AAElB;AACA,SAASC,mBAAmB,QAAQ;AACpC,SAASC,OAAO,QAAQ;AACxB,SAASC,qBAAqB,QAAQ;AAMtC,OAAO,MAAMC,yBAAA,GAAsE,MAAAA,CAAO;EACxFC,uBAAuB;EACvBC,IAAI;EACJC,OAAO;EACPC,GAAG;EACHC,YAAY;EACZC;AAAI,CACL;EACC,IAAI,CAACA,IAAA,EAAM;IACT,OAAO;EACT;EAEA,IAAIC,WAAA,GAAc;EAClB,IAAIC,oBAAA,GAA4C,EAAE;EAClD,IAAIC,sBAAA,GAAmC,EAAE;EACzC,IAAIC,cAAA,GAAgC;EACpC,IAAIC,eAAA,GAAkB;EACtB,IAAIC,SAAA;EACJ,IAAIC,aAAA;EACJ,IAAIC,UAAA;EACJ,IAAIC,yBAAA,GAAgE,EAA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Aa;QAAEmB,KAAA,EAAO7B;MAAU,CAAC;MACnDR,GAAA;MACAM,cAAA;MACAwD;IACF;EACF,EAAE,OAAOsB,KAAA,EAAO;IACdrF,OAAA,CAAQsF,MAAM,CAACC,IAAI,CAAC;MAClBC,GAAA,EAAKH,KAAA;MACLI,GAAA,EAAK,sCAAsC3F,uBAAA;IAC7C;IACA;EACF;EAEA,oBACE8B,IAAA,CAAClC,mBAAA;IACCmB,UAAA,EAAYA,UAAA;IACZD,yBAAA,EAA2BA,yBAAA;IAC3Bd,uBAAA,EAAyBA,uBAAA;IACzB0B,IAAA,EAAMA,IAAA;IACNpB,WAAA,EAAaA,WAAA;IACbC,oBAAA,EAAsBA,oBAAA;IACtBC,sBAAA,EAAwBA,sBAAA;IACxBE,eAAA,EAAiBA,eAAA;IACjBD,cAAA,EAAgBA,cAAA;IAChBE,SAAA,EAAWA,SAAA;IACXC,aAAA,EAAeA,aAAA;IACfC,UAAA,EAAYA;;AAGlB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/HierarchyTree/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA+B,MAAM,OAAO,CAAA;AAEnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAMpD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAuEtD,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/HierarchyTree/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA+B,MAAM,OAAO,CAAA;AAEnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAMpD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA0EtD,CAAA"}
@@ -7,6 +7,7 @@ import { useConfig } from '../../providers/Config/index.js';
7
7
  import { useHierarchy } from '../../providers/Hierarchy/index.js';
8
8
  import { Tree } from '../Tree/index.js';
9
9
  export const HierarchyTree = ({
10
+ baseFilter,
10
11
  collectionSlug,
11
12
  filterByCollections,
12
13
  icon,
@@ -47,6 +48,7 @@ export const HierarchyTree = ({
47
48
  }, [collectionSlug, toggleNodeForCollection]);
48
49
  return /*#__PURE__*/_jsx(Tree, {
49
50
  allPossibleTypeValues: allPossibleTypeValues,
51
+ baseFilter: baseFilter,
50
52
  collectionSlug: collectionSlug,
51
53
  expandedNodes: expandedNodes,
52
54
  filterByCollections: filterByCollections,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["DEFAULT_HIERARCHY_TREE_LIMIT","React","useCallback","useMemo","useConfig","useHierarchy","Tree","HierarchyTree","collectionSlug","filterByCollections","icon","initialData","initialDataProp","onNodeClick","selectedNodeId","useAsTitle","useAsTitleProp","getExpandedNodesForCollection","getTreeDataForCollection","toggleNodeForCollection","typeFieldName","contextData","getEntityConfig","collectionConfig","hierarchyConfig","hierarchy","undefined","parentFieldName","treeLimit","admin","allPossibleTypeValues","relatedCollections","Object","keys","expandedNodes","handleToggleNode","id","_jsx","toggleNode"],"sources":["../../../src/elements/HierarchyTree/index.tsx"],"sourcesContent":["'use client'\n\nimport { DEFAULT_HIERARCHY_TREE_LIMIT } from 'payload/shared'\nimport React, { useCallback, useMemo } from 'react'\n\nimport type { HierarchyTreeProps } from './types.js'\n\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useHierarchy } from '../../providers/Hierarchy/index.js'\nimport { Tree } from '../Tree/index.js'\n\nexport const HierarchyTree: React.FC<HierarchyTreeProps> = ({\n collectionSlug,\n filterByCollections,\n icon,\n initialData: initialDataProp,\n onNodeClick,\n selectedNodeId,\n useAsTitle: useAsTitleProp,\n}) => {\n const {\n getExpandedNodesForCollection,\n getTreeDataForCollection,\n toggleNodeForCollection,\n typeFieldName,\n } = useHierarchy()\n\n // Get initialData from context (cleared on refresh, hydrated by HydrateHierarchyProvider)\n // Falls back to prop for first render before hydration completes\n const contextData = getTreeDataForCollection(collectionSlug)\n const initialData = contextData ?? initialDataProp\n const { getEntityConfig } = useConfig()\n\n const collectionConfig = getEntityConfig({ collectionSlug })\n const hierarchyConfig =\n collectionConfig.hierarchy && typeof collectionConfig.hierarchy === 'object'\n ? collectionConfig.hierarchy\n : undefined\n const parentFieldName = hierarchyConfig?.parentFieldName\n const treeLimit = hierarchyConfig?.admin?.treeLimit ?? DEFAULT_HIERARCHY_TREE_LIMIT\n const useAsTitle = useAsTitleProp ?? collectionConfig.admin?.useAsTitle\n\n // Get all possible type values from relatedCollections for filtering empty arrays\n const allPossibleTypeValues = useMemo(\n () =>\n hierarchyConfig?.relatedCollections\n ? Object.keys(hierarchyConfig.relatedCollections)\n : undefined,\n [hierarchyConfig?.relatedCollections],\n )\n\n // Get expanded nodes for THIS collection specifically\n const expandedNodes = useMemo(\n () => getExpandedNodesForCollection(collectionSlug),\n [collectionSlug, getExpandedNodesForCollection],\n )\n\n // Toggle node for THIS collection specifically\n const handleToggleNode = useCallback(\n ({ id }: { id: number | string }) => {\n toggleNodeForCollection(collectionSlug, id)\n },\n [collectionSlug, toggleNodeForCollection],\n )\n\n return (\n <Tree\n allPossibleTypeValues={allPossibleTypeValues}\n collectionSlug={collectionSlug}\n expandedNodes={expandedNodes}\n filterByCollections={filterByCollections}\n icon={icon}\n initialData={initialData}\n onNodeClick={onNodeClick}\n parentFieldName={parentFieldName}\n selectedNodeId={selectedNodeId}\n toggleNode={handleToggleNode}\n treeLimit={treeLimit}\n typeFieldName={typeFieldName}\n useAsTitle={useAsTitle}\n />\n )\n}\n"],"mappings":"AAAA;;;AAEA,SAASA,4BAA4B,QAAQ;AAC7C,OAAOC,KAAA,IAASC,WAAW,EAAEC,OAAO,QAAQ;AAI5C,SAASC,SAAS,QAAQ;AAC1B,SAASC,YAAY,QAAQ;AAC7B,SAASC,IAAI,QAAQ;AAErB,OAAO,MAAMC,aAAA,GAA8CA,CAAC;EAC1DC,cAAc;EACdC,mBAAmB;EACnBC,IAAI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ACCwB,qBAAA,EAAuBA,qBAAA;IACvBtB,cAAA,EAAgBA,cAAA;IAChB0B,aAAA,EAAeA,aAAA;IACfzB,mBAAA,EAAqBA,mBAAA;IACrBC,IAAA,EAAMA,IAAA;IACNC,WAAA,EAAaA,WAAA;IACbE,WAAA,EAAaA,WAAA;IACbc,eAAA,EAAiBA,eAAA;IACjBb,cAAA,EAAgBA,cAAA;IAChBwB,UAAA,EAAYH,gBAAA;IACZP,SAAA,EAAWA,SAAA;IACXR,aAAA,EAAeA,aAAA;IACfL,UAAA,EAAYA;;AAGlB","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["DEFAULT_HIERARCHY_TREE_LIMIT","React","useCallback","useMemo","useConfig","useHierarchy","Tree","HierarchyTree","baseFilter","collectionSlug","filterByCollections","icon","initialData","initialDataProp","onNodeClick","selectedNodeId","useAsTitle","useAsTitleProp","getExpandedNodesForCollection","getTreeDataForCollection","toggleNodeForCollection","typeFieldName","contextData","getEntityConfig","collectionConfig","hierarchyConfig","hierarchy","undefined","parentFieldName","treeLimit","admin","allPossibleTypeValues","relatedCollections","Object","keys","expandedNodes","handleToggleNode","id","_jsx","toggleNode"],"sources":["../../../src/elements/HierarchyTree/index.tsx"],"sourcesContent":["'use client'\n\nimport { DEFAULT_HIERARCHY_TREE_LIMIT } from 'payload/shared'\nimport React, { useCallback, useMemo } from 'react'\n\nimport type { HierarchyTreeProps } from './types.js'\n\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useHierarchy } from '../../providers/Hierarchy/index.js'\nimport { Tree } from '../Tree/index.js'\n\nexport const HierarchyTree: React.FC<HierarchyTreeProps> = ({\n baseFilter,\n collectionSlug,\n filterByCollections,\n icon,\n initialData: initialDataProp,\n onNodeClick,\n selectedNodeId,\n useAsTitle: useAsTitleProp,\n}) => {\n const {\n getExpandedNodesForCollection,\n getTreeDataForCollection,\n toggleNodeForCollection,\n typeFieldName,\n } = useHierarchy()\n\n // Get initialData from context (cleared on refresh, hydrated by HydrateHierarchyProvider)\n // Falls back to prop for first render before hydration completes\n const contextData = getTreeDataForCollection(collectionSlug)\n const initialData = contextData ?? initialDataProp\n\n const { getEntityConfig } = useConfig()\n\n const collectionConfig = getEntityConfig({ collectionSlug })\n const hierarchyConfig =\n collectionConfig.hierarchy && typeof collectionConfig.hierarchy === 'object'\n ? collectionConfig.hierarchy\n : undefined\n const parentFieldName = hierarchyConfig?.parentFieldName\n const treeLimit = hierarchyConfig?.admin?.treeLimit ?? DEFAULT_HIERARCHY_TREE_LIMIT\n const useAsTitle = useAsTitleProp ?? collectionConfig.admin?.useAsTitle\n\n // Get all possible type values from relatedCollections for filtering empty arrays\n const allPossibleTypeValues = useMemo(\n () =>\n hierarchyConfig?.relatedCollections\n ? Object.keys(hierarchyConfig.relatedCollections)\n : undefined,\n [hierarchyConfig?.relatedCollections],\n )\n\n // Get expanded nodes for THIS collection specifically\n const expandedNodes = useMemo(\n () => getExpandedNodesForCollection(collectionSlug),\n [collectionSlug, getExpandedNodesForCollection],\n )\n\n // Toggle node for THIS collection specifically\n const handleToggleNode = useCallback(\n ({ id }: { id: number | string }) => {\n toggleNodeForCollection(collectionSlug, id)\n },\n [collectionSlug, toggleNodeForCollection],\n )\n\n return (\n <Tree\n allPossibleTypeValues={allPossibleTypeValues}\n baseFilter={baseFilter}\n collectionSlug={collectionSlug}\n expandedNodes={expandedNodes}\n filterByCollections={filterByCollections}\n icon={icon}\n initialData={initialData}\n onNodeClick={onNodeClick}\n parentFieldName={parentFieldName}\n selectedNodeId={selectedNodeId}\n toggleNode={handleToggleNode}\n treeLimit={treeLimit}\n typeFieldName={typeFieldName}\n useAsTitle={useAsTitle}\n />\n )\n}\n"],"mappings":"AAAA;;;AAEA,SAASA,4BAA4B,QAAQ;AAC7C,OAAOC,KAAA,IAASC,WAAW,EAAEC,OAAO,QAAQ;AAI5C,SAASC,SAAS,QAAQ;AAC1B,SAASC,YAAY,QAAQ;AAC7B,SAASC,IAAI,QAAQ;AAErB,OAAO,MAAMC,a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,CAAC5B,cAAA,EAAgBW,uBAAA,CAAwB;EAG3C,oBACEkB,IAAA,CAAChC,IAAA;IACCyB,qBAAA,EAAuBA,qBAAA;IACvBvB,UAAA,EAAYA,UAAA;IACZC,cAAA,EAAgBA,cAAA;IAChB0B,aAAA,EAAeA,aAAA;IACfzB,mBAAA,EAAqBA,mBAAA;IACrBC,IAAA,EAAMA,IAAA;IACNC,WAAA,EAAaA,WAAA;IACbE,WAAA,EAAaA,WAAA;IACbc,eAAA,EAAiBA,eAAA;IACjBb,cAAA,EAAgBA,cAAA;IAChBwB,UAAA,EAAYH,gBAAA;IACZP,SAAA,EAAWA,SAAA;IACXR,aAAA,EAAeA,aAAA;IACfL,UAAA,EAAYA;;AAGlB","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import type { TypeWithID } from 'payload';
1
+ import type { TypeWithID, Where } from 'payload';
2
2
  import type React from 'react';
3
3
  export type HierarchyDocument = {
4
4
  [key: string]: unknown;
@@ -9,6 +9,7 @@ export type HierarchyNode = {
9
9
  title: string;
10
10
  };
11
11
  export type HierarchyInitialData = {
12
+ baseFilter?: null | Where;
12
13
  docs: HierarchyDocument[];
13
14
  loadedParents: Record<string, {
14
15
  hasMore: boolean;
@@ -17,6 +18,7 @@ export type HierarchyInitialData = {
17
18
  }>;
18
19
  };
19
20
  export type HierarchyTreeProps = {
21
+ baseFilter?: null | Where;
20
22
  collectionSlug: string;
21
23
  filterByCollections?: string[];
22
24
  icon?: React.ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/elements/HierarchyTree/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,MAAM,MAAM,iBAAiB,GAAG;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB,GAAG,UAAU,CAAA;AAEd,MAAM,MAAM,a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eAAe,EAAE,MAAM,CAAA;IACvB,QAAQ,EAAE,OAAO,CAAA;IACjB,cAAc,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAA;IACvC,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/elements/HierarchyTree/types.ts"],"sourcesContent":["import type { TypeWithID } from 'payload'\nimport type React from 'react'\n\nexport type HierarchyDocument = {\n [key: string]: unknown\n} & TypeWithID\n\nexport type HierarchyNode = {\n hasChildren: boolean\n id: number | string\n title: string\n}\n\nexport type HierarchyInitialData = {\n docs: HierarchyDocument[]\n // Metadata about what was loaded - keyed by parent ID ('null' for root)\n loadedParents: Record<string, { hasMore: boolean; loadedCount?: number; totalDocs: number }>\n}\n\nexport type HierarchyTreeProps = {\n collectionSlug: string\n filterByCollections?: string[]\n icon?: React.ReactNode\n /** Initial data for first render (before context hydration). After hydration, context data takes precedence. */\n initialData?: HierarchyInitialData | null\n onNodeClick?: ({ id }: { id: null | number | string }) => void\n selectedNodeId?: null | number | string\n useAsTitle?: string\n}\n\nexport type CachedChildren = {\n children: HierarchyDocument[]\n hasMore: boolean\n page: number\n totalDocs: number\n}\n\nexport type TreeNodeProps = {\n cache?: React.MutableRefObject<Map<string, CachedChildren>>\n collectionSlug: string\n depth?: number\n expandedNodes: Set<number | string>\n limit?: number\n node: HierarchyNode\n onSelect: ({ id }: { id: number | string }) => void\n onToggle: ({ id }: { id: number | string }) => void\n parentFieldName: string\n selected: boolean\n selectedNodeId?: null | number | string\n useAsTitle?: string\n}\n"],"mappings":"AAqCA","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/elements/HierarchyTree/types.ts"],"sourcesContent":["import type { TypeWithID, Where } from 'payload'\nimport type React from 'react'\n\nexport type HierarchyDocument = {\n [key: string]: unknown\n} & TypeWithID\n\nexport type HierarchyNode = {\n hasChildren: boolean\n id: number | string\n title: string\n}\n\nexport type HierarchyInitialData = {\n baseFilter?: null | Where\n docs: HierarchyDocument[]\n // Metadata about what was loaded - keyed by parent ID ('null' for root)\n loadedParents: Record<string, { hasMore: boolean; loadedCount?: number; totalDocs: number }>\n}\n\nexport type HierarchyTreeProps = {\n baseFilter?: null | Where\n collectionSlug: string\n filterByCollections?: string[]\n icon?: React.ReactNode\n /** Initial data for first render (before context hydration). After hydration, context data takes precedence. */\n initialData?: HierarchyInitialData | null\n onNodeClick?: ({ id }: { id: null | number | string }) => void\n selectedNodeId?: null | number | string\n useAsTitle?: string\n}\n\nexport type CachedChildren = {\n children: HierarchyDocument[]\n hasMore: boolean\n page: number\n totalDocs: number\n}\n\nexport type TreeNodeProps = {\n cache?: React.MutableRefObject<Map<string, CachedChildren>>\n collectionSlug: string\n depth?: number\n expandedNodes: Set<number | string>\n limit?: number\n node: HierarchyNode\n onSelect: ({ id }: { id: number | string }) => void\n onToggle: ({ id }: { id: number | string }) => void\n parentFieldName: string\n selected: boolean\n selectedNodeId?: null | number | string\n useAsTitle?: string\n}\n"],"mappings":"AAuCA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/HydrateHierarchyProvider/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAA;AAIvF,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,EAAE,CAAC,6BAA6B,CAgD5E,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/HydrateHierarchyProvider/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAA;AAIvF,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,EAAE,CAAC,6BAA6B,CAmD5E,CAAA"}
@@ -4,9 +4,10 @@ import { c as _c } from "react/compiler-runtime";
4
4
  import { useEffect } from 'react';
5
5
  import { useHierarchy } from '../../providers/Hierarchy/index.js';
6
6
  export const HydrateHierarchyProvider = t0 => {
7
- const $ = _c(15);
7
+ const $ = _c(16);
8
8
  const {
9
9
  allowedCollections,
10
+ baseFilter,
10
11
  collectionSlug,
11
12
  expandedNodes,
12
13
  parent,
@@ -24,10 +25,11 @@ export const HydrateHierarchyProvider = t0 => {
24
25
  } = useHierarchy();
25
26
  let t1;
26
27
  let t2;
27
- if ($[0] !== allowedCollections || $[1] !== collectionSlug || $[2] !== expandedNodes || $[3] !== hydrate || $[4] !== parent || $[5] !== parentFieldName || $[6] !== selectedFilters || $[7] !== tableData || $[8] !== treeData || $[9] !== treeLimit || $[10] !== typeFieldName || $[11] !== useAsTitle || $[12] !== viewCollectionSlug) {
28
+ if ($[0] !== allowedCollections || $[1] !== baseFilter || $[2] !== collectionSlug || $[3] !== expandedNodes || $[4] !== hydrate || $[5] !== parent || $[6] !== parentFieldName || $[7] !== selectedFilters || $[8] !== tableData || $[9] !== treeData || $[10] !== treeLimit || $[11] !== typeFieldName || $[12] !== useAsTitle || $[13] !== viewCollectionSlug) {
28
29
  t1 = () => {
29
30
  hydrate({
30
31
  allowedCollections,
32
+ baseFilter,
31
33
  collectionSlug,
32
34
  expandedNodes,
33
35
  parent,
@@ -41,25 +43,26 @@ export const HydrateHierarchyProvider = t0 => {
41
43
  viewCollectionSlug
42
44
  });
43
45
  };
44
- t2 = [allowedCollections, collectionSlug, expandedNodes, hydrate, parent, parentFieldName, selectedFilters, tableData, treeData, treeLimit, typeFieldName, useAsTitle, viewCollectionSlug];
46
+ t2 = [allowedCollections, baseFilter, collectionSlug, expandedNodes, hydrate, parent, parentFieldName, selectedFilters, tableData, treeData, treeLimit, typeFieldName, useAsTitle, viewCollectionSlug];
45
47
  $[0] = allowedCollections;
46
- $[1] = collectionSlug;
47
- $[2] = expandedNodes;
48
- $[3] = hydrate;
49
- $[4] = parent;
50
- $[5] = parentFieldName;
51
- $[6] = selectedFilters;
52
- $[7] = tableData;
53
- $[8] = treeData;
54
- $[9] = treeLimit;
55
- $[10] = typeFieldName;
56
- $[11] = useAsTitle;
57
- $[12] = viewCollectionSlug;
58
- $[13] = t1;
59
- $[14] = t2;
48
+ $[1] = baseFilter;
49
+ $[2] = collectionSlug;
50
+ $[3] = expandedNodes;
51
+ $[4] = hydrate;
52
+ $[5] = parent;
53
+ $[6] = parentFieldName;
54
+ $[7] = selectedFilters;
55
+ $[8] = tableData;
56
+ $[9] = treeData;
57
+ $[10] = treeLimit;
58
+ $[11] = typeFieldName;
59
+ $[12] = useAsTitle;
60
+ $[13] = viewCollectionSlug;
61
+ $[14] = t1;
62
+ $[15] = t2;
60
63
  } else {
61
- t1 = $[13];
62
- t2 = $[14];
64
+ t1 = $[14];
65
+ t2 = $[15];
63
66
  }
64
67
  useEffect(t1, t2);
65
68
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","useEffect","useHierarchy","HydrateHierarchyProvider","t0","$","allowedCollections","collectionSlug","expandedNodes","parent","parentFieldName","selectedFilters","tableData","treeData","treeLimit","typeFieldName","useAsTitle","viewCollectionSlug","hydrate","t1","t2"],"sources":["../../../src/elements/HydrateHierarchyProvider/index.tsx"],"sourcesContent":["'use client'\n\nimport type React from 'react'\n\nimport { useEffect } from 'react'\n\nimport type { HydrateHierarchyProviderProps } from '../../providers/Hierarchy/types.js'\n\nimport { useHierarchy } from '../../providers/Hierarchy/index.js'\n\nexport const HydrateHierarchyProvider: React.FC<HydrateHierarchyProviderProps> = ({\n allowedCollections,\n collectionSlug,\n expandedNodes,\n parent,\n parentFieldName,\n selectedFilters,\n tableData,\n treeData,\n treeLimit,\n typeFieldName,\n useAsTitle,\n viewCollectionSlug,\n}) => {\n const { hydrate } = useHierarchy()\n\n useEffect(() => {\n hydrate({\n allowedCollections,\n collectionSlug,\n expandedNodes,\n parent,\n parentFieldName,\n selectedFilters,\n tableData,\n treeData,\n treeLimit,\n typeFieldName,\n useAsTitle,\n viewCollectionSlug,\n })\n }, [\n allowedCollections,\n collectionSlug,\n expandedNodes,\n hydrate,\n parent,\n parentFieldName,\n selectedFilters,\n tableData,\n treeData,\n treeLimit,\n typeFieldName,\n useAsTitle,\n viewCollectionSlug,\n ])\n\n return null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAIA,SAASC,SAAS,QAAQ;AAI1B,SAASC,YAAY,QAAQ;AAE7B,OAAO,MAAMC,wBAAA,GAAoEC,EAAA;EAAA,MAAAC,CAAA,GAAAL,EAAA;EAAC;IAAAM,kBAAA;IAAAC,cAAA;IAAAC,aAAA;IAAAC,MAAA;IAAAC,eAAA;IAAAC,eAAA;IAAAC,SAAA;IAAAC,QAAA;IAAAC,SAAA;IAAAC,aAAA;IAAAC,UAAA;IAAAC;EAAA,IAAAb,EAajF;EACC;IAAAc;EAAA,IAAoBhB,YAAA;EAAA,IAAAiB,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAf,CAAA,QAAAC,kBAAA,IAAAD,CAAA,QAAAE,cAAA,IAAAF,CAAA,QAAAG,aAAA,IAAAH,CAAA,QAAAa,OAAA,IAAAb,CAAA,QAAAI,MAAA,IAAAJ,CAAA,QAAAK,eAAA,IAAAL,CAAA,QAAAM,eAAA,IAAAN,CAAA,QAAAO,SAAA,IAAAP,CAAA,QAAAQ,QAAA,IAAAR,CAAA,QAAAS,SAAA,IAAAT,CAAA,SAAAU,aAAA,IAAAV,CAAA,SAAAW,UAAA,IAAAX,CAAA,SAAAY,kBAAA;IAEVE,EAAA,GAAAA,CAAA;MACRD,OAAA;QAAAZ,kBAAA;QAAAC,cAAA;QAAAC,aAAA;QAAAC,MAAA;QAAAC,eAAA;QAAAC,eAAA;QAAAC,SAAA;QAAAC,QAAA;QAAAC,SAAA;QAAAC,aAAA;QAAAC,UAAA;QAAAC;MAAA,CAaA;IAAA;IACCG,EAAA,IACDd,kBAAA,EACAC,cAAA,EACAC,aAAA,EACAU,OAAA,EACAT,MAAA,EACAC,eAAA,EACAC,eAAA,EACAC,SAAA,EACAC,QAAA,EACAC,SAAA,EACAC,aAAA,EACAC,UAAA,EACAC,kBAAA;IACDZ,CAAA,MAAAC,kBAAA;IAAAD,CAAA,MAAAE,cAAA;IAAAF,CAAA,MAAAG,aAAA;IAAAH,CAAA,MAAAa,OAAA;IAAAb,CAAA,MAAAI,MAAA;IAAAJ,CAAA,MAAAK,eAAA;IAAAL,CAAA,MAAAM,eAAA;IAAAN,CAAA,MAAAO,SAAA;IAAAP,CAAA,MAAAQ,QAAA;IAAAR,CAAA,MAAAS,SAAA;IAAAT,CAAA,OAAAU,aAAA;IAAAV,CAAA,OAAAW,UAAA;IAAAX,CAAA,OAAAY,kBAAA;IAAAZ,CAAA,OAAAc,EAAA;IAAAd,CAAA,OAAAe,EAAA;EAAA;IAAAD,EAAA,GAAAd,CAAA;IAAAe,EAAA,GAAAf,CAAA;EAAA;EA7BDJ,SAAA,CAAUkB,EAeV,EAAGC,EAcF;EAAA;AAAA,CAGH","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","useEffect","useHierarchy","HydrateHierarchyProvider","t0","$","allowedCollections","baseFilter","collectionSlug","expandedNodes","parent","parentFieldName","selectedFilters","tableData","treeData","treeLimit","typeFieldName","useAsTitle","viewCollectionSlug","hydrate","t1","t2"],"sources":["../../../src/elements/HydrateHierarchyProvider/index.tsx"],"sourcesContent":["'use client'\n\nimport type React from 'react'\n\nimport { useEffect } from 'react'\n\nimport type { HydrateHierarchyProviderProps } from '../../providers/Hierarchy/types.js'\n\nimport { useHierarchy } from '../../providers/Hierarchy/index.js'\n\nexport const HydrateHierarchyProvider: React.FC<HydrateHierarchyProviderProps> = ({\n allowedCollections,\n baseFilter,\n collectionSlug,\n expandedNodes,\n parent,\n parentFieldName,\n selectedFilters,\n tableData,\n treeData,\n treeLimit,\n typeFieldName,\n useAsTitle,\n viewCollectionSlug,\n}) => {\n const { hydrate } = useHierarchy()\n\n useEffect(() => {\n hydrate({\n allowedCollections,\n baseFilter,\n collectionSlug,\n expandedNodes,\n parent,\n parentFieldName,\n selectedFilters,\n tableData,\n treeData,\n treeLimit,\n typeFieldName,\n useAsTitle,\n viewCollectionSlug,\n })\n }, [\n allowedCollections,\n baseFilter,\n collectionSlug,\n expandedNodes,\n hydrate,\n parent,\n parentFieldName,\n selectedFilters,\n tableData,\n treeData,\n treeLimit,\n typeFieldName,\n useAsTitle,\n viewCollectionSlug,\n ])\n\n return null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAIA,SAASC,SAAS,QAAQ;AAI1B,SAASC,YAAY,QAAQ;AAE7B,OAAO,MAAMC,wBAAA,GAAoEC,EAAA;EAAA,MAAAC,CAAA,GAAAL,EAAA;EAAC;IAAAM,kBAAA;IAAAC,UAAA;IAAAC,cAAA;IAAAC,aAAA;IAAAC,MAAA;IAAAC,eAAA;IAAAC,eAAA;IAAAC,SAAA;IAAAC,QAAA;IAAAC,SAAA;IAAAC,aAAA;IAAAC,UAAA;IAAAC;EAAA,IAAAd,EAcjF;EACC;IAAAe;EAAA,IAAoBjB,YAAA;EAAA,IAAAkB,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAhB,CAAA,QAAAC,kBAAA,IAAAD,CAAA,QAAAE,UAAA,IAAAF,CAAA,QAAAG,cAAA,IAAAH,CAAA,QAAAI,aAAA,IAAAJ,CAAA,QAAAc,OAAA,IAAAd,CAAA,QAAAK,MAAA,IAAAL,CAAA,QAAAM,eAAA,IAAAN,CAAA,QAAAO,eAAA,IAAAP,CAAA,QAAAQ,SAAA,IAAAR,CAAA,QAAAS,QAAA,IAAAT,CAAA,SAAAU,SAAA,IAAAV,CAAA,SAAAW,aAAA,IAAAX,CAAA,SAAAY,UAAA,IAAAZ,CAAA,SAAAa,kBAAA;IAEVE,EAAA,GAAAA,CAAA;MACRD,OAAA;QAAA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;IACrB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;AAElC,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAwDhC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/Link/index.tsx"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,cAAc,CAAA;AAEzC,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,QAAA,MAAM,QAAQ;eAsFk7F,MAAO,SAAS;2CAtF13F,CAAA;AAgBtF,KAAK,KAAK,GAAG;IACX;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;AAElC,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAwDhC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/PublishButton/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAWvD,OAAO,KAA2C,MAAM,OAAO,CAAA;AAe/D,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EAAE,SAAS,GACjB,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,wBAA6B,qBAoSpD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/PublishButton/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAWvD,OAAO,KAA2C,MAAM,OAAO,CAAA;AAe/D,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EAAE,SAAS,GACjB,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,wBAA6B,qBAgTpD"}
@@ -189,9 +189,11 @@ export function PublishButton({
189
189
  }
190
190
  });
191
191
  if (result_0) {
192
+ setUnpublishedVersionCount(0);
193
+ setMostRecentVersionIsAutosaved(false);
192
194
  setHasPublishedDoc(true);
193
195
  }
194
- }, [api, collectionSlug, globalSlug, id, setHasPublishedDoc, submit, uploadStatus]);
196
+ }, [api, collectionSlug, globalSlug, id, setHasPublishedDoc, setMostRecentVersionIsAutosaved, setUnpublishedVersionCount, submit, uploadStatus]);
195
197
  // Publish to all locales unless there are localized fields AND defaultLocalePublishOption is 'active'
196
198
  const isDefaultPublishAll = !isSpecificLocalePublishEnabled || localization && localization?.defaultLocalePublishOption !== 'active';
197
199
  const activeLocale = localization && localization?.locales.find(locale_0 => typeof locale_0 === 'string' ? locale_0 === localeCode : locale_0.code === localeCode);